| Modifier and Type | Method and Description |
|---|---|
<T> Optional<T> |
as(Class<T> type)
Returns inner value as optional of input type, if the inner value is absent or not an instance of the input
type an empty optional is returned
|
<T> Optional<List<T>> |
asList()
Shortcut for as(List.class), with malleable generic type
|
<K,V> Optional<Map<K,V>> |
asMap()
Shortcut for as(Map.class), with malleable generic type
|
Optional<Object> |
asObject() |
Optional<String> |
asString()
Shortcut for as(String.class)
|
ConverterMaybe |
convert() |
static <T extends Weak<T>> |
empty() |
boolean |
equals(Object o) |
OptionalWeak<W> |
filter(Predicate<? super W> predicate) |
<U> Optional<U> |
flatMap(Function<? super W,Optional<U>> mapper) |
W |
get() |
int |
hashCode() |
void |
ifPresent(Consumer<? super W> consumer) |
boolean |
isPresent() |
<U> Optional<U> |
map(Function<? super W,? extends U> mapper) |
static <T extends Weak<T>> |
of(T val) |
W |
orElse(W other) |
W |
orElseGet(Supplier<? extends W> other) |
<X extends Throwable> |
orElseThrow(Supplier<? extends X> exceptionSupplier) |
String |
toString() |
public static <T extends Weak<T>> OptionalWeak<T> of(T val)
public static <T extends Weak<T>> OptionalWeak<T> empty()
public W get()
public boolean isPresent()
public OptionalWeak<W> filter(Predicate<? super W> predicate)
public <U> Optional<U> map(Function<? super W,? extends U> mapper)
Optional.map(Function)public <U> Optional<U> flatMap(Function<? super W,Optional<U>> mapper)
Optional.flatMap(Function)public W orElse(W other)
Optional.orElse(Object)public W orElseGet(Supplier<? extends W> other)
Optional.orElseGet(Supplier)public <X extends Throwable> W orElseThrow(Supplier<? extends X> exceptionSupplier) throws X extends Throwable
X extends ThrowableOptional.orElseThrow(Supplier)public <T> Optional<T> as(Class<T> type)
T - cast typetype - cast typepublic <T> Optional<List<T>> asList()
as(Class)public <K,V> Optional<Map<K,V>> asMap()
as(Class)public ConverterMaybe convert()
Copyright © 2017. All rights reserved.