Package org.apache.wayang.core.util
Class Optional<T>
- java.lang.Object
-
- org.apache.wayang.core.util.Optional<T>
-
public abstract class Optional<T> extends java.lang.ObjectUtility similar toOptional. However, it supportsnullas a valid value.
-
-
Constructor Summary
Constructors Constructor Description Optional()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract TgetValue()abstract booleanisAvailable()static <T> Optional<T>na()Create a n/a instance.static <T> Optional<T>of(T value)Create a new instance with the givenvalue.abstract java.util.stream.Stream<T>stream()
-
-
-
Method Detail
-
isAvailable
public abstract boolean isAvailable()
- Returns:
- whether this instance contains a value.
-
getValue
public abstract T getValue()
- Returns:
- the value contained by this instance
- Throws:
java.lang.IllegalStateException- ifisAvailable()isfalse
-
stream
public abstract java.util.stream.Stream<T> stream()
- Returns:
- a
Streamcontaining the optional value
-
-