Package | Description |
---|---|
io.vavr | |
io.vavr.collection |
Purely functional collections based on Traversable.
|
io.vavr.concurrent |
This package contains basic building blocks creating fast, asynchronous, non-blocking parallel code.
|
io.vavr.control |
Modifier and Type | Method and Description |
---|---|
static <T,_1 extends Option<Try<T>>> |
Patterns.$Future(API.Match.Pattern<_1,?> p1) |
Modifier and Type | Method and Description |
---|---|
Option<T> |
Lazy.filter(java.util.function.Predicate<? super T> predicate) |
<R> Option<R> |
API.Match.option(API.Match.Case<? extends T,? extends R>... cases) |
static <T> Option<T> |
API.Option(T value)
Alias for
of(Object) |
default Option<T> |
Value.toOption()
Converts this to an
Option . |
Modifier and Type | Method and Description |
---|---|
static <T1,T2,R> Function2<T1,T2,Option<R>> |
Function2.lift(java.util.function.BiFunction<? super T1,? super T2,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <R> Function0<Option<R>> |
CheckedFunction0.lift(CheckedFunction0<? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,R> Function1<T1,Option<R>> |
CheckedFunction1.lift(CheckedFunction1<? super T1,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,R> Function2<T1,T2,Option<R>> |
CheckedFunction2.lift(CheckedFunction2<? super T1,? super T2,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,R> |
CheckedFunction3.lift(CheckedFunction3<? super T1,? super T2,? super T3,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,R> |
CheckedFunction4.lift(CheckedFunction4<? super T1,? super T2,? super T3,? super T4,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,R> |
CheckedFunction5.lift(CheckedFunction5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,T6,R> |
CheckedFunction6.lift(CheckedFunction6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,T6,T7,R> |
CheckedFunction7.lift(CheckedFunction7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
CheckedFunction8.lift(CheckedFunction8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,R> Function1<T1,Option<R>> |
Function1.lift(java.util.function.Function<? super T1,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,R> |
Function3.lift(Function3<? super T1,? super T2,? super T3,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,R> |
Function4.lift(Function4<? super T1,? super T2,? super T3,? super T4,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,R> |
Function5.lift(Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,T6,R> |
Function6.lift(Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,T6,T7,R> |
Function7.lift(Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
Function8.lift(Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
static <R> Function0<Option<R>> |
Function0.lift(java.util.function.Supplier<? extends R> partialFunction)
Lifts the given
partialFunction into a total function that returns an Option result. |
Modifier and Type | Method and Description |
---|---|
default <K> Option<Map<K,T>> |
Traversable.arrangeBy(java.util.function.Function<? super T,? extends K> getKey)
Matches each element with a unique key that you extract from it.
|
default Option<java.lang.Double> |
Traversable.average()
Calculates the average of this elements, assuming that the element type is
Number . |
default Option<T> |
Traversable.find(java.util.function.Predicate<? super T> predicate)
Returns the first element of this which satisfies the given predicate.
|
default Option<T> |
Traversable.findLast(java.util.function.Predicate<? super T> predicate)
Returns the last element of this which satisfies the given predicate.
|
default Option<T> |
Iterator.findLast(java.util.function.Predicate<? super T> predicate) |
Option<V> |
TreeMap.get(K key) |
Option<Traversable<V>> |
Multimap.get(K key)
Returns the
Some of value to which the specified key
is mapped, or None if this multimap contains no mapping for the key. |
Option<V> |
Map.get(K key)
Returns the
Some of value to which the specified key
is mapped, or None if this map contains no mapping for the key. |
Option<V> |
LinkedHashMap.get(K key) |
Option<V> |
HashMap.get(K key) |
Option<T> |
TreeSet.headOption() |
default Option<T> |
Traversable.headOption()
Returns the first element of a non-empty Traversable as
Option . |
Option<T> |
LinkedHashSet.headOption() |
Option<T> |
HashSet.headOption() |
Option<java.lang.Integer> |
CharSeq.indexOfOption(CharSeq str)
Returns the index of the first occurrence of the given element as an
Option . |
Option<java.lang.Integer> |
CharSeq.indexOfOption(CharSeq str,
int fromIndex)
Returns the index of the first occurrence of the given element as an
Option ,
starting the search at the specified index. |
default Option<java.lang.Integer> |
Seq.indexOfOption(T element)
Returns the index of the first occurrence of the given element as an
Option |
default Option<java.lang.Integer> |
Seq.indexOfOption(T element,
int from)
Returns the index of the first occurrence of the given element,
after or at some start index as an
Option |
default Option<java.lang.Integer> |
Seq.indexOfSliceOption(java.lang.Iterable<? extends T> that)
Finds first index where this sequence contains a given sequence as an
Option of a slice. |
default Option<java.lang.Integer> |
Seq.indexOfSliceOption(java.lang.Iterable<? extends T> that,
int from)
Finds first index after or at a start index where this sequence contains a given sequence as an
Option of a slice. |
default Option<java.lang.Integer> |
Seq.indexWhereOption(java.util.function.Predicate<? super T> predicate)
Finds index of first element satisfying some predicate as an
Option . |
default Option<java.lang.Integer> |
Seq.indexWhereOption(java.util.function.Predicate<? super T> predicate,
int from)
Finds index of the first element satisfying some predicate after or at
some start index as an
Option . |
Option<Vector<T>> |
Vector.initOption() |
Option<TreeSet<T>> |
TreeSet.initOption() |
Option<TreeMap<K,V>> |
TreeMap.initOption() |
default Option<Seq<T>> |
Tree.initOption() |
default Option<? extends Traversable<T>> |
Traversable.initOption()
Dual of Traversable.tailOption(), returning all elements except the last as
Option . |
default Option<Stream<T>> |
Stream.initOption() |
Option<? extends SortedSet<T>> |
SortedSet.initOption() |
Option<? extends SortedMultimap<K,V>> |
SortedMultimap.initOption() |
Option<? extends SortedMap<K,V>> |
SortedMap.initOption() |
Option<? extends Set<T>> |
Set.initOption() |
Option<? extends Seq<T>> |
Seq.initOption() |
Option<? extends Multimap<K,V>> |
Multimap.initOption() |
Option<? extends Map<K,V>> |
Map.initOption() |
default Option<List<T>> |
List.initOption() |
Option<LinkedHashSet<T>> |
LinkedHashSet.initOption() |
Option<LinkedHashMap<K,V>> |
LinkedHashMap.initOption() |
Option<? extends LinearSeq<T>> |
LinearSeq.initOption() |
default Option<Iterator<T>> |
Iterator.initOption() |
Option<? extends IndexedSeq<T>> |
IndexedSeq.initOption() |
Option<HashSet<T>> |
HashSet.initOption() |
Option<HashMap<K,V>> |
HashMap.initOption() |
Option<CharSeq> |
CharSeq.initOption() |
default Option<BitSet<T>> |
BitSet.initOption() |
Option<Array<T>> |
Array.initOption() |
Option<java.lang.Integer> |
CharSeq.lastIndexOfOption(CharSeq str)
Returns the index of the last occurrence of the given element as an
Option . |
Option<java.lang.Integer> |
CharSeq.lastIndexOfOption(CharSeq str,
int fromIndex)
Returns the index of the last occurrence of the given element as an
Option ,
starting the search at the specified index. |
Option<java.lang.Integer> |
CharSeq.lastIndexOfOption(int ch,
int fromIndex)
Returns the index of the last occurrence of the given element as an
Option ,
starting the search at the specified index. |
default Option<java.lang.Integer> |
Seq.lastIndexOfOption(T element)
Returns the index of the last occurrence of the given element as an
Option . |
default Option<java.lang.Integer> |
Seq.lastIndexOfOption(T element,
int end)
Returns the index of the last occurrence of the given element before or at a given end index as an
Option . |
default Option<java.lang.Integer> |
Seq.lastIndexOfSliceOption(java.lang.Iterable<? extends T> that)
Finds last index where this sequence contains a given sequence as a slice as an
Option . |
default Option<java.lang.Integer> |
Seq.lastIndexOfSliceOption(java.lang.Iterable<? extends T> that,
int end)
Finds last index before or at a given end index where this sequence contains a given sequence as a slice as an
Option . |
default Option<java.lang.Integer> |
Seq.lastIndexWhereOption(java.util.function.Predicate<? super T> predicate)
Finds index of last element satisfying some predicate as an
Option . |
default Option<java.lang.Integer> |
Seq.lastIndexWhereOption(java.util.function.Predicate<? super T> predicate,
int end)
Finds index of last element satisfying some predicate before or at given end index as an
Option . |
default Option<T> |
Traversable.lastOption()
Dual of Traversable.headOption(), returning the last element as
Option . |
default Option<T> |
Traversable.max()
Calculates the maximum of this elements according to their natural order.
|
default Option<T> |
Traversable.maxBy(java.util.Comparator<? super T> comparator)
Calculates the maximum of this elements using a specific comparator.
|
default <U extends java.lang.Comparable<? super U>> |
Traversable.maxBy(java.util.function.Function<? super T,? extends U> f)
Calculates the maximum of this elements within the co-domain of a specific function.
|
default Option<T> |
Traversable.min()
Calculates the minimum of this elements according to their natural order in O(n).
|
default Option<T> |
Traversable.minBy(java.util.Comparator<? super T> comparator)
Calculates the minimum of this elements using a specific comparator.
|
default <U extends java.lang.Comparable<? super U>> |
Traversable.minBy(java.util.function.Function<? super T,? extends U> f)
Calculates the minimum of this elements within the co-domain of a specific function.
|
default Option<T> |
List.peekOption()
Returns the head element without modifying the List.
|
default Option<Tuple2<T,List<T>>> |
List.pop2Option()
Removes the head element from this List.
|
default Option<List<T>> |
List.popOption()
Removes the head element from this List.
|
default Option<T> |
Traversable.reduceLeftOption(java.util.function.BiFunction<? super T,? super T,? extends T> op)
Shortcut for
isEmpty() ? Option.none() : Option.some(reduceLeft(op)) . |
Option<T> |
Foldable.reduceLeftOption(java.util.function.BiFunction<? super T,? super T,? extends T> op)
Accumulates the elements of this Foldable by successively calling the given operation
op from the left. |
default Option<T> |
Foldable.reduceOption(java.util.function.BiFunction<? super T,? super T,? extends T> op)
Accumulates the elements of this Foldable by successively calling the given operation
op . |
default Option<T> |
Traversable.reduceRightOption(java.util.function.BiFunction<? super T,? super T,? extends T> op)
Shortcut for
isEmpty() ? Option.none() : Option.some(reduceRight(op)) . |
Option<T> |
Foldable.reduceRightOption(java.util.function.BiFunction<? super T,? super T,? extends T> op)
Accumulates the elements of this Foldable by successively calling the given operation
op from the right. |
default Option<T> |
Traversable.singleOption()
Returns the only element of a Traversable as
Option . |
Option<Vector<T>> |
Vector.tailOption() |
Option<TreeSet<T>> |
TreeSet.tailOption() |
Option<TreeMap<K,V>> |
TreeMap.tailOption() |
default Option<Seq<T>> |
Tree.tailOption() |
Option<? extends Traversable<T>> |
Traversable.tailOption()
Drops the first element of a non-empty Traversable and returns an
Option . |
default Option<Stream<T>> |
Stream.tailOption() |
Option<? extends SortedSet<T>> |
SortedSet.tailOption() |
Option<? extends SortedMultimap<K,V>> |
SortedMultimap.tailOption() |
Option<? extends SortedMap<K,V>> |
SortedMap.tailOption() |
Option<? extends Set<T>> |
Set.tailOption() |
Option<? extends Seq<T>> |
Seq.tailOption() |
Option<? extends Multimap<K,V>> |
Multimap.tailOption() |
Option<? extends Map<K,V>> |
Map.tailOption() |
default Option<List<T>> |
List.tailOption() |
Option<LinkedHashSet<T>> |
LinkedHashSet.tailOption() |
Option<LinkedHashMap<K,V>> |
LinkedHashMap.tailOption() |
Option<? extends LinearSeq<T>> |
LinearSeq.tailOption() |
default Option<Iterator<T>> |
Iterator.tailOption() |
Option<? extends IndexedSeq<T>> |
IndexedSeq.tailOption() |
Option<HashSet<T>> |
HashSet.tailOption() |
Option<HashMap<K,V>> |
HashMap.tailOption() |
Option<CharSeq> |
CharSeq.tailOption() |
default Option<BitSet<T>> |
BitSet.tailOption() |
Option<Array<T>> |
Array.tailOption() |
Modifier and Type | Method and Description |
---|---|
Tuple2<Option<V>,TreeMap<K,V>> |
TreeMap.computeIfPresent(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction) |
Tuple2<Option<V>,? extends SortedMap<K,V>> |
SortedMap.computeIfPresent(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction) |
Tuple2<Option<V>,? extends Map<K,V>> |
Map.computeIfPresent(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
If the value for the specified key is present, attempts to
compute a new mapping given the key and its current mapped value.
|
Tuple2<Option<V>,LinkedHashMap<K,V>> |
LinkedHashMap.computeIfPresent(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction) |
Tuple2<Option<V>,HashMap<K,V>> |
HashMap.computeIfPresent(K key,
java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction) |
default Function1<java.lang.Integer,Option<T>> |
Seq.lift()
Turns this sequence into a plain function returning an Option result.
|
default Function1<K,Option<V>> |
Map.lift()
Turns this map into a plain function returning an Option result.
|
Modifier and Type | Method and Description |
---|---|
static CharSeq |
CharSeq.unfold(java.lang.Character seed,
java.util.function.Function<? super java.lang.Character,Option<Tuple2<? extends java.lang.Character,? extends java.lang.Character>>> f)
Creates a CharSeq from a seed value and a function.
|
static <T> Vector<T> |
Vector.unfold(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends T>>> f)
Creates a Vector from a seed value and a function.
|
static <T> Stream<T> |
Stream.unfold(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends T>>> f)
Creates a Stream from a seed value and a function.
|
static <T> Queue<T> |
Queue.unfold(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends T>>> f)
Creates a Queue from a seed value and a function.
|
static <T> List<T> |
List.unfold(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends T>>> f)
Creates a list from a seed value and a function.
|
static <T> Iterator<T> |
Iterator.unfold(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends T>>> f)
Creates an iterator from a seed value and a function.
|
static <T> Array<T> |
Array.unfold(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends T>>> f)
Creates an Array from a seed value and a function.
|
static <T> CharSeq |
CharSeq.unfoldLeft(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends java.lang.Character>>> f)
Creates a CharSeq from a seed value and a function.
|
static <T,U> Vector<U> |
Vector.unfoldLeft(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends U>>> f)
Creates a Vector from a seed value and a function.
|
static <T,U> Stream<U> |
Stream.unfoldLeft(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends U>>> f)
Creates a Stream from a seed value and a function.
|
static <T,U> Queue<U> |
Queue.unfoldLeft(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends U>>> f)
Creates a Queue from a seed value and a function.
|
static <T,U> List<U> |
List.unfoldLeft(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends U>>> f)
Creates a list from a seed value and a function.
|
static <T,U> Iterator<U> |
Iterator.unfoldLeft(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends U>>> f)
Creates an iterator from a seed value and a function.
|
static <T,U> Array<U> |
Array.unfoldLeft(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends T,? extends U>>> f)
Creates an Array from a seed value and a function.
|
static <T> CharSeq |
CharSeq.unfoldRight(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends java.lang.Character,? extends T>>> f)
Creates a CharSeq from a seed value and a function.
|
static <T,U> Vector<U> |
Vector.unfoldRight(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends U,? extends T>>> f)
Creates a Vector from a seed value and a function.
|
static <T,U> Stream<U> |
Stream.unfoldRight(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends U,? extends T>>> f)
Creates a Stream from a seed value and a function.
|
static <T,U> Queue<U> |
Queue.unfoldRight(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends U,? extends T>>> f)
Creates a Queue from a seed value and a function.
|
static <T,U> List<U> |
List.unfoldRight(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends U,? extends T>>> f)
Creates a list from a seed value and a function.
|
static <T,U> Iterator<U> |
Iterator.unfoldRight(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends U,? extends T>>> f)
Creates an iterator from a seed value and a function.
|
static <T,U> Array<U> |
Array.unfoldRight(T seed,
java.util.function.Function<? super T,Option<Tuple2<? extends U,? extends T>>> f)
Creates an Array from a seed value and a function.
|
Modifier and Type | Method and Description |
---|---|
default Option<java.lang.Throwable> |
Future.getCause()
Returns the underlying exception of this Future, syntactic sugar for
future.getValue().map(Try::getCause) . |
Option<Try<T>> |
Future.getValue()
Returns the value of the Future.
|
Modifier and Type | Method and Description |
---|---|
static <T> Future<Option<T>> |
Future.find(java.util.concurrent.ExecutorService executorService,
java.lang.Iterable<? extends Future<? extends T>> futures,
java.util.function.Predicate<? super T> predicate)
Returns a
Future that eventually succeeds with the first result of the given Future s which
matches the given predicate . |
static <T> Future<Option<T>> |
Future.find(java.lang.Iterable<? extends Future<? extends T>> futures,
java.util.function.Predicate<? super T> predicate)
Returns a
Future that eventually succeeds with the first result of the given Future s which
matches the given predicate . |
Modifier and Type | Class and Description |
---|---|
static class |
Option.None<T>
None is a singleton representation of the undefined
Option . |
static class |
Option.Some<T>
Some represents a defined
Option . |
Modifier and Type | Method and Description |
---|---|
default <R> Option<R> |
Option.collect(PartialFunction<? super T,? extends R> partialFunction)
Collects value that is in the domain of the given
partialFunction by mapping the value to type R . |
Option<Either.LeftProjection<L,R>> |
Either.LeftProjection.filter(java.util.function.Predicate<? super L> predicate)
Returns
Some value of type L if this is a left projection of a Left value and the predicate
applies to the underlying value. |
default Option<Either<L,R>> |
Either.filter(java.util.function.Predicate<? super R> predicate)
Filters this right-biased
Either by testing a predicate. |
Option<Either.RightProjection<L,R>> |
Either.RightProjection.filter(java.util.function.Predicate<? super R> predicate)
Returns
Some value of type R if this is a right projection of a Right value and the predicate
applies to the underlying value. |
default Option<Validation<E,T>> |
Validation.filter(java.util.function.Predicate<? super T> predicate) |
default Option<T> |
Option.filter(java.util.function.Predicate<? super T> predicate)
Returns
Some(value) if this is a Some and the value satisfies the given predicate. |
default <U> Option<U> |
Option.flatMap(java.util.function.Function<? super T,? extends Option<? extends U>> mapper)
Maps the value to a new
Option if this is a Some , otherwise returns None . |
default <U> Option<U> |
Option.map(java.util.function.Function<? super T,? extends U> mapper)
Maps the value and wraps it in a new
Some if this is a Some , returns None . |
static <T> Option<T> |
Option.narrow(Option<? extends T> option)
Narrows a widened
Option<? extends T> to Option<T>
by performing a type-safe cast. |
static <T> Option<T> |
Option.none()
Returns the single instance of
None |
static <T> Option<T> |
Option.of(T value)
Creates a new
Option of a given value. |
static <T> Option<T> |
Option.ofOptional(java.util.Optional<? extends T> optional)
Wraps a Java Optional to a new Option
|
default Option<T> |
Option.onEmpty(java.lang.Runnable action)
Runs a Java Runnable passed as parameter if this
Option is empty. |
default Option<T> |
Option.orElse(Option<? extends T> other)
Returns this
Option if it is nonempty, otherwise return the alternative. |
default Option<T> |
Option.orElse(java.util.function.Supplier<? extends Option<? extends T>> supplier)
Returns this
Option if it is nonempty, otherwise return the result of evaluating supplier. |
default Option<T> |
Option.peek(java.util.function.Consumer<? super T> action)
Applies an action to this value, if this option is defined, otherwise does nothing.
|
static <T> Option<Seq<T>> |
Option.sequence(java.lang.Iterable<? extends Option<? extends T>> values)
Reduces many
Option s into a single Option by transforming an
Iterable<Option<? extends T>> into a Option<Seq<T>> . |
static <T> Option<T> |
Option.some(T value)
Creates a new
Some of a given value. |
static <T> Option<T> |
Option.when(boolean condition,
java.util.function.Supplier<? extends T> supplier)
Creates
Some of suppliers value if condition is true, or None in other case |
static <T> Option<T> |
Option.when(boolean condition,
T value)
Creates
Some of value if condition is true, or None in other case |
Modifier and Type | Method and Description |
---|---|
static <T> Option<T> |
Option.narrow(Option<? extends T> option)
Narrows a widened
Option<? extends T> to Option<T>
by performing a type-safe cast. |
default Option<T> |
Option.orElse(Option<? extends T> other)
Returns this
Option if it is nonempty, otherwise return the alternative. |
Modifier and Type | Method and Description |
---|---|
default <U> Option<U> |
Option.flatMap(java.util.function.Function<? super T,? extends Option<? extends U>> mapper)
Maps the value to a new
Option if this is a Some , otherwise returns None . |
default Option<T> |
Option.orElse(java.util.function.Supplier<? extends Option<? extends T>> supplier)
Returns this
Option if it is nonempty, otherwise return the result of evaluating supplier. |
static <T> Option<Seq<T>> |
Option.sequence(java.lang.Iterable<? extends Option<? extends T>> values)
Reduces many
Option s into a single Option by transforming an
Iterable<Option<? extends T>> into a Option<Seq<T>> . |
default <U> U |
Option.transform(java.util.function.Function<? super Option<T>,? extends U> f)
Transforms this
Option . |
Copyright © 2017. All Rights Reserved.