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