T
- stored value.public class Optional<T> extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
Optional.Marshaller<T> |
static interface |
Optional.Unmarshaller<T> |
Modifier and Type | Method and 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 Option
|
static <T> Optional<T> |
of(String source,
Optional.Unmarshaller<T> unmarshaller)
Parse the existing string value into the Option
|
static <T> Optional<T> |
of(T val)
Wrap the existing value in Option.
|
Optional<T> |
orAnother(Optional<T> alternative) |
T |
orElse(T elseVal) |
String |
toString() |
String |
toString(Optional.Marshaller<T> m) |
public static <T> Optional<T> none()
T
- typepublic static <T> Optional<T> of(T val)
T
- typeval
- value to wrappublic static <T> Optional<T> of(String source, Optional.Unmarshaller<T> unmarshaller)
T
- typesource
- source stringunmarshaller
- unmarshaller lambda parsing the (String -> T)public static <T> Optional<T> eitherOf(T val)
public boolean hasValue()
public String toString(Optional.Marshaller<T> m)
public T get()
Copyright © 2016. All rights reserved.