Package no.digipost.util
Interface ViewableAsOptional<V>
-
- All Known Subinterfaces:
Assignment<V>,AtMostOne<T>,ViewableAsOptional.Single<V>
- All Known Implementing Classes:
ChainableAssignment,OneTimeAssignment
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ViewableAsOptional<V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceViewableAsOptional.Single<V>ASupplierwhich is alsoViewableAsOptional.static classViewableAsOptional.TooManyElementsAn object which was attempted to be viewed as aOptionalrepresentation of itself contained more than one element, and is thus not applicable for such conversion.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<V>toOptional()Get anOptionalrepresentation of this object.
-
-
-
Method Detail
-
toOptional
Optional<V> toOptional() throws ViewableAsOptional.TooManyElements
Get anOptionalrepresentation of this object. If it contains more elements than one, and thus cannot be viewed as anOptionalwithout loosing any information, aViewableAsOptional.TooManyElementsis thrown.- Returns:
- the
Optionalrepresentation of this object. - Throws:
ViewableAsOptional.TooManyElements- if this object contains more than one element, and thus is not applicable for lossless conversion to an Optional.
-
-