- All Known Subinterfaces:
Container<K,,V, O> ListContainer<T>
- All Known Implementing Classes:
ContainerImpl,ListContainerImpl,NonExistentContainer,NonExistentListContainer,OptionalValueImplementation
public interface OptionalValue<V>
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexists()get()The actual value of classOptionalValuerepresented by thisOptionalValue.default <C> CgetAs()Callsget()and casts itOptionalValue.default booleanisNull()static <V> @NotNull OptionalValue<V>of()static <V> @NotNull OptionalValue<V>of(V value)
-
Method Details
-
get
V get()The actual value of classOptionalValuerepresented by thisOptionalValue.- Returns:
OptionalValueornull
-
getAs
default <C> C getAs()Callsget()and casts itOptionalValue.- Type Parameters:
C- class to cast to- Returns:
OptionalValueornull- Throws:
ClassCastException- ifOptionalValuecannot be cast toOptionalValue.
-
isNull
default boolean isNull()- Returns:
trueifget()will returnnull.
-
exists
boolean exists()- Returns:
trueif thisOptionalValueexists in theAbstractDatathisOptionalValueis of.
-
of
- Type Parameters:
V- type- Parameters:
value- value- Returns:
- new
OptionalValue, that exists.
-
of
- Type Parameters:
V- type- Returns:
- new
OptionalValue, that does not exist.
-