- 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>empty()booleanequals(Object o)Optional<T>filter(Predicate<? super T> predicate)static <T> Optional<T>fromNullable(T nullableReference)Tget()inthashCode()booleanisEmpty()booleanisPresent()<F> Optional<F>map(Function<? super T,F> mapper)static <T> Optional<T>of(T arg)Tor(T defaultValue)TorNull()<X extends Throwable>
TorThrow(Supplier<? extends X> exceptionFunction)Optional<T>toJavaOptional()StringtoString()
-
-
-
Method Detail
-
of
public static <T> Optional<T> of(T arg)
-
fromNullable
public static <T> Optional<T> fromNullable(T nullableReference)
-
empty
public static <T> Optional<T> empty()
-
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
-
-