public interface Option<T> extends FlatMap1<Option.µ,T>, Filterable<T>, Holder<T>
| Modifier and Type | Interface and Description |
|---|---|
static class |
Option.µ |
static class |
Option.None<T> |
static class |
Option.Some<T> |
| Modifier and Type | Method and Description |
|---|---|
default Option<T> |
filter(Matcher1<T> matcher) |
default <R> Option<R> |
flatMap(Function1<T,? extends Higher1<Option.µ,R>> map) |
default <V> Option<V> |
flatten() |
default <U> U |
fold(Producer<U> orElse,
Function1<T,U> mapper) |
static <T> Option<T> |
from(java.util.Optional<T> optional) |
default Option<T> |
ifEmpty(java.lang.Runnable run) |
default Option<T> |
ifPresent(Consumer1<T> consumer) |
boolean |
isEmpty() |
boolean |
isPresent() |
default <R> Option<R> |
map(Function1<T,R> mapper) |
com.github.tonivade.purefun.type.OptionModule |
module() |
static Monad<Option.µ> |
monad() |
static <T> Option<T> |
narrowK(Higher1<Option.µ,T> hkt) |
static <T> Option<T> |
none() |
static <T> Option<T> |
of(Producer<T> producer) |
default T |
orElse(Producer<T> producer) |
default T |
orElse(T value) |
default <X extends java.lang.Throwable> |
orElseThrow(Producer<X> producer) |
default Sequence<T> |
sequence() |
static <T> Option<T> |
some(T value) |
default java.util.stream.Stream<T> |
stream() |
default java.util.Optional<T> |
toOptional() |
static <T> Option<T> some(T value)
static <T> Option<T> none()
static <T> Option<T> from(java.util.Optional<T> optional)
boolean isPresent()
boolean isEmpty()
default Option<T> filter(Matcher1<T> matcher)
filter in interface Filterable<T>default <X extends java.lang.Throwable> T orElseThrow(Producer<X> producer) throws X extends java.lang.Throwable
X extends java.lang.Throwabledefault java.util.stream.Stream<T> stream()
default java.util.Optional<T> toOptional()
com.github.tonivade.purefun.type.OptionModule module()