public class Optional<T>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> Optional<T> |
empty() |
boolean |
equals(java.lang.Object o) |
static <T> Optional<T> |
fromNullable(T nullOrReference) |
T |
get() |
int |
hashCode() |
void |
ifPresent(Consumer<T> consumer) |
boolean |
isEmpty() |
boolean |
isPresent() |
static <T> Optional<T> |
of(T reference) |
public static <T> Optional<T> empty()
public static <T> Optional<T> of(T reference)
public static <T> Optional<T> fromNullable(T nullOrReference)
public boolean isEmpty()
public boolean isPresent()
public T get()
java.lang.IllegalStateException
- if the instance is emptypublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object