public class Optional<T> extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Optional<T> |
empty() |
static <T> Optional<T> |
fromNullable(T nullOrReference) |
T |
get() |
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()
IllegalStateException - if the instance is emptyCopyright © 2014. All rights reserved.