Package com.github.underscore
Class Optional<T>
- java.lang.Object
-
- com.github.underscore.Optional<T>
-
public final class Optional<T> extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Optional<T>
absent()
boolean
equals(Object o)
static <T> Optional<T>
fromNullable(T nullableReference)
T
get()
int
hashCode()
boolean
isEmpty()
boolean
isPresent()
<F> Optional<F>
map(Function<? super T,F> mapper)
static <T> Optional<T>
of(T arg)
T
or(T defaultValue)
T
orNull()
<X extends Throwable>
TorThrow(Supplier<? extends X> exceptionFunction)
String
toString()
-
-
-
Method Detail
-
of
public static <T> Optional<T> of(T arg)
-
fromNullable
public static <T> Optional<T> fromNullable(T nullableReference)
-
absent
public static <T> Optional<T> absent()
-
get
public T get()
-
orNull
public T orNull()
-
isEmpty
public boolean isEmpty()
-
isPresent
public boolean isPresent()
-
orThrow
public <X extends Throwable> T orThrow(Supplier<? extends X> exceptionFunction) throws X extends Throwable
- Throws:
X extends Throwable
-
-