T
- type of the wrapped referencepublic final class Optional<T> extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Optional<T> |
empty() |
boolean |
equals(Object obj) |
Optional<T> |
filter(Predicate<? super T> predicate) |
<U> Optional<U> |
flatMap(Function<? super T,Optional<U>> mapper) |
T |
get() |
int |
hashCode() |
void |
ifPresent(Consumer<? super T> consumer) |
boolean |
isPresent() |
<U> Optional<U> |
map(Function<? super T,? extends U> mapper) |
static <T> Optional<T> |
of(T value) |
static <T> Optional<T> |
ofNullable(T value) |
T |
orElse(T other) |
T |
orElseGet(Supplier<? extends T> other) |
<X extends Throwable> |
orElseThrow(Supplier<? extends X> exceptionSupplier) |
String |
toString() |
public static <T> Optional<T> empty()
public static <T> Optional<T> of(T value)
public static <T> Optional<T> ofNullable(T value)
public boolean isPresent()
public T get()
public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X extends Throwable
X extends Throwable
Copyright © 2018. All rights reserved.