Modifier and Type | Class and Description |
---|---|
class |
None<T>
Represents an empty
Option . |
class |
Some<T>
Represents an
Option holding a value. |
Modifier and Type | Method and Description |
---|---|
static <T> Option<T> |
Option.apply(T value)
|
default Option<T> |
Try.asOption()
|
static <T> Option<T> |
Option.empty()
Creates an empty Option.
In practice this returns a singleton as it anyways cannot represent a value/state. |
Option<Either<L,R>> |
LeftProjection.filter(java.util.function.Predicate<L> predicate)
|
Option<Either<L,R>> |
RightProjection.filter(java.util.function.Predicate<R> predicate)
|
default Option<T> |
Option.filter(java.util.function.Predicate<T> p)
Returns this Option if it is nonempty and applying the predicate p to this Option's value returns
true . |
default Option<T> |
Option.filterNot(java.util.function.Predicate<T> p)
Returns this Option if it is nonempty and applying the predicate p to this Option's value returns
false . |
<R> Option<R> |
None.map(java.util.function.Function<T,R> f)
Always returns
this . |
<R> Option<R> |
Option.map(java.util.function.Function<T,R> function)
Returns an Option consisting of the result of applying the given function to the current
Some . |
<R> Option<R> |
Some.map(java.util.function.Function<T,R> f)
Returns an Option consisting of the result of applying the given function to the current value.
|
static <T> Option<T> |
Option.ofOptional(Optional<T> optional)
|
Option<T> |
None.orElse(java.util.function.Supplier<Option<T>> s)
Always the value provided by the supplier.
|
Option<T> |
Option.orElse(java.util.function.Supplier<Option<T>> supplier)
Returns this Option if it is nonempty, otherwise return the result of provided by the supplier.
|
Option<T> |
Some.orElse(java.util.function.Supplier<Option<T>> s)
Always returns
this . |
Modifier and Type | Method and Description |
---|---|
Option<T> |
None.orElse(java.util.function.Supplier<Option<T>> s)
Always the value provided by the supplier.
|
Option<T> |
Option.orElse(java.util.function.Supplier<Option<T>> supplier)
Returns this Option if it is nonempty, otherwise return the result of provided by the supplier.
|
Option<T> |
Some.orElse(java.util.function.Supplier<Option<T>> s)
Always returns
this . |
Copyright © 2015. All rights reserved.