Package org.openjdk.jmh.util
Class Optional<T>
- java.lang.Object
-
- org.openjdk.jmh.util.Optional<T>
-
- Type Parameters:
T
- stored value.
- All Implemented Interfaces:
Serializable
public class Optional<T> extends Object implements Serializable
Option class- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Optional<T>
eitherOf(T val)
boolean
equals(Object o)
T
get()
int
hashCode()
boolean
hasValue()
static <T> Optional<T>
none()
Produce empty Optionstatic <T> Optional<T>
of(T val)
Wrap the existing value in Option.Optional<T>
orAnother(Optional<T> alternative)
T
orElse(T elseVal)
String
toString()
-
-
-
Method Detail
-
none
public static <T> Optional<T> none()
Produce empty Option- Type Parameters:
T
- type- Returns:
- empty option
-
of
public static <T> Optional<T> of(T val)
Wrap the existing value in Option.- Type Parameters:
T
- type- Parameters:
val
- value to wrap- Returns:
- option with value
-
eitherOf
public static <T> Optional<T> eitherOf(T val)
-
hasValue
public boolean hasValue()
-
get
public T get()
-
-