Package no.digipost.util
Interface ViewableAsOptional.Single<V>
-
- Type Parameters:
V- The type of the supplied value
- All Superinterfaces:
Supplier<V>,ViewableAsOptional<V>
- All Known Subinterfaces:
Assignment<V>
- All Known Implementing Classes:
ChainableAssignment,OneTimeAssignment
- Enclosing interface:
- ViewableAsOptional<V>
- 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 static interface ViewableAsOptional.Single<V> extends Supplier<V>, ViewableAsOptional<V>
ASupplierwhich is alsoViewableAsOptional.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface no.digipost.util.ViewableAsOptional
ViewableAsOptional.Single<V>, ViewableAsOptional.TooManyElements
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Optional<V>toOptional()Convert this object to anOptionalby wrapping the value returned fromSupplier.get().
-
-
-
Method Detail
-
toOptional
default Optional<V> toOptional() throws ViewableAsOptional.TooManyElements
Convert this object to anOptionalby wrapping the value returned fromSupplier.get().- Specified by:
toOptionalin interfaceViewableAsOptional<V>- Returns:
- the value returned from
Supplier.get(), wrapped in anOptional. Ifget()returnsnull,Optional.empty()is returned. - Throws:
ViewableAsOptional.TooManyElements- if this object contains more than one element, and thus is not applicable for lossless conversion to an Optional.
-
-