public interface Option<T> extends To<Option<T>>, OrElseValue<T,Option<T>>, MonadicValue<T>, Zippable<T>, Recoverable<T>, Sealed2<T,Option.None<T>>, java.lang.Iterable<T>, Higher<DataWitness.option,T>, java.io.Serializable
1. Some : a value is present 2. None : no value is presentUnlike Optional, Option does not expose an unsafe `get` method. `fold` or `orElse` can be used instead.
is a lazy / reactive sub-class of Option
Modifier and Type | Interface and Description |
---|---|
static class |
Option.Comprehensions |
static class |
Option.None<T> |
static class |
Option.Some<T> |
Modifier and Type | Method and Description |
---|---|
static <T,R> Option<R> |
accumulateJust(java.lang.Iterable<Option<T>> maybes,
java.util.function.Function<? super T,R> mapper,
Monoid<R> reducer)
Accumulate the results only from those Maybes which have a value present, using the supplied mapping function to
convert the data from each Maybe before reducing them using the supplied Monoid (a combining BiFunction/BinaryOperator and identity element that takes two
input values of the same type and returns the combined result)
cyclops2.Monoids .. |
static <T,R> Option<R> |
accumulateJust(java.lang.Iterable<Option<T>> maybes,
Reducer<R,T> reducer)
Accummulating operation using the supplied Reducer (@see cyclops2.Reducers).
|
static <T> Option<T> |
accumulateJust(Monoid<T> reducer,
java.lang.Iterable<Option<T>> maybes)
Accumulate the results only from those Maybes which have a value present, using the supplied Monoid (a combining BiFunction/BinaryOperator and identity element that takes two
input values of the same type and returns the combined result)
cyclops.Monoids . |
static <T> Option<T> |
attempt(CheckedSupplier<T> s) |
default <R> Option<R> |
attemptFlatMap(java.util.function.Function<? super T,? extends Option<? extends R>> fn) |
default <R> Option<R> |
concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
A flattening transformation operation that takes the first value from the returned Iterable.
|
default Option<T> |
eager() |
default <T1> Option<T1> |
emptyUnit() |
Option<T> |
filter(java.util.function.Predicate<? super T> fn)
Keep only elements for which the supplied predicates hold
e.g.
|
default Option<T> |
filterNot(java.util.function.Predicate<? super T> fn)
Remove any elements for which the predicate holds (inverse operation to filter)
e.g.
|
<R> Option<R> |
flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper)
A flattening transformation operation (@see
Optional.flatMap(Function) |
<R> R |
fold(java.util.function.Function<? super T,? extends R> some,
java.util.function.Supplier<? extends R> none) |
default <R1,R> Option<R> |
forEach2(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
Perform a two level nested internal iteration over this MonadicValue and the
supplied MonadicValue
|
default <R1,R> Option<R> |
forEach2(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1,
java.util.function.BiFunction<? super T,? super R1,java.lang.Boolean> filterFunction,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
Perform a two level nested internal iteration over this MonadicValue and the
supplied stream
|
default <T2,R1,R2,R> |
forEach3(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1,
java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2,
Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
Perform a three level nested internal iteration over this MonadicValue and the
supplied MonadicValues
|
default <T2,R1,R2,R> |
forEach3(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1,
java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2,
Function3<? super T,? super R1,? super R2,java.lang.Boolean> filterFunction,
Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
Perform a three level nested internal iteration over this MonadicValue and the
supplied MonadicValues
|
default <T2,R1,R2,R3,R> |
forEach4(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1,
java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2,
Function3<? super T,? super R1,? super R2,? extends MonadicValue<R3>> value3,
Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
Perform a four level nested internal iteration over this MonadicValue and the
supplied MonadicValues
|
default <T2,R1,R2,R3,R> |
forEach4(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1,
java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2,
Function3<? super T,? super R1,? super R2,? extends MonadicValue<R3>> value3,
Function4<? super T,? super R1,? super R2,? super R3,java.lang.Boolean> filterFunction,
Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
Perform a four level nested internal iteration over this MonadicValue and the
supplied MonadicValues
Maybe.of(3)
.forEach4(a->Maybe.just(a+10),
(a,b)->Maybe.just(a+b),
(a,b,c)->Maybe.none(),
(a,b,c,d)->a+b+c<100,
(a,b,c,d)->a+b+c+d);
//Maybe.none
|
static <T> Option<T> |
fromFuture(Future<T> future) |
static <T> Option<T> |
fromIterable(java.lang.Iterable<T> iterable)
Construct an Option that contains a single value extracted from the supplied Iterable
|
static <T> Option<T> |
fromNullable(T t) |
static <T> Option<T> |
fromOptional(java.util.Optional<T> opt)
Construct an equivalent Option from the Supplied Optional
|
static <T> Option<T> |
fromPublisher(org.reactivestreams.Publisher<T> pub)
Construct a Maybe that contains a single value extracted from the supplied reactive-streams Publisher
|
static <R> Option<R> |
fromStream(java.util.stream.Stream<R> apply) |
boolean |
isPresent() |
default Maybe<T> |
lazy() |
<R> Option<R> |
map(java.util.function.Function<? super T,? extends R> mapper)
Transform this functor using the supplied transformation function
|
default <R> Option<R> |
mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
A flattening transformation operation that takes the first value from the returned Publisher.
|
static <T> Option<T> |
narrow(Option<? extends T> broad)
Narrow covariant type parameter
|
static <T> Option<T> |
narrowK(Higher<DataWitness.option,T> opt) |
static <T> Option<T> |
none() |
default Option<T> |
notNull()
Filter elements retaining only values which are not null
|
static <T> Option<T> |
of(T value)
Construct an Option which contains the provided (non-null) value
Equivalent to @see
some(Object) |
static <T> Option<T> |
ofNullable(T value)
Option<Integer> maybe = Option.ofNullable(null);
//None
Option<Integer> maybe = Option.ofNullable(10);
//Option[10], Some[10]
|
default <U> Option<U> |
ofType(java.lang.Class<? extends U> type)
Keep only those elements in a stream that are of a given type.
|
default Option<T> |
orElseUse(Option<T> opt) |
default Option<T> |
peek(java.util.function.Consumer<? super T> c)
Peek at the current value of this Transformable, without transforming it
|
Option<T> |
recover(java.util.function.Supplier<? extends T> value) |
Option<T> |
recover(T value) |
Option<T> |
recoverWith(java.util.function.Supplier<? extends Option<T>> fn) |
static <T> Option<ReactiveSeq<T>> |
sequence(java.lang.Iterable<? extends Option<T>> maybes)
Sequence operation, take a Collection of Options and turn it into a Option with a Collection
By constrast with
sequenceJust(Iterable) if any Option types are None / zero
the return type will be an zero Option / None |
static <T> Option<ReactiveSeq<T>> |
sequence(ReactiveSeq<? extends Option<T>> stream) |
static <T> Option<ReactiveSeq<T>> |
sequence(java.util.stream.Stream<? extends Option<T>> maybes)
Sequence operation, take a Stream of Option and turn it into a Option with a Stream
By constrast with
Maybe.sequenceJust(Iterable) Option#zero/ None types are
result in the returned Maybe being Option.zero / None |
static <T> Option<ReactiveSeq<T>> |
sequenceJust(java.lang.Iterable<? extends Option<T>> maybes)
Sequence operation, take a Collection of Options and turn it into a Option with a Collection
Only successes are retained.
|
static <T> Option<T> |
some(T value) |
static <T,R> Option<R> |
tailRec(T initial,
java.util.function.Function<? super T,? extends Option<? extends Either<T,R>>> fn) |
default Maybe<T> |
toMaybe() |
default Trampoline<Maybe<T>> |
toTrampoline() |
static <T,R> Option<ReactiveSeq<R>> |
traverse(java.util.function.Function<? super T,? extends R> fn,
ReactiveSeq<Option<T>> stream) |
default <T> Option<T> |
unit(T unit) |
static <T> Higher<DataWitness.option,T> |
widen(Option<T> narrow) |
static <C2,T> Higher<C2,Higher<DataWitness.option,T>> |
widen2(Higher<C2,Option<T>> nestedMaybe) |
default <T2,R> Option<R> |
zip(java.util.function.BiFunction<? super T,? super T2,? extends R> fn,
org.reactivestreams.Publisher<? extends T2> app)
Zip (combine) this Zippable with the supplied Publisher, using the supplied combining function
|
default <T2,R> Option<R> |
zip(java.lang.Iterable<? extends T2> app,
java.util.function.BiFunction<? super T,? super T2,? extends R> fn)
Zip (combine) this Zippable with the supplied Iterable using the supplied combining function
|
default <U> Option<Tuple2<T,U>> |
zip(java.lang.Iterable<? extends U> other) |
default <S,U> Option<Tuple3<T,S,U>> |
zip3(java.lang.Iterable<? extends S> second,
java.lang.Iterable<? extends U> third) |
default <S,U,R> Option<R> |
zip3(java.lang.Iterable<? extends S> second,
java.lang.Iterable<? extends U> third,
Function3<? super T,? super S,? super U,? extends R> fn3) |
default <T2,T3,T4> Option<Tuple4<T,T2,T3,T4>> |
zip4(java.lang.Iterable<? extends T2> second,
java.lang.Iterable<? extends T3> third,
java.lang.Iterable<? extends T4> fourth) |
default <T2,T3,T4,R> |
zip4(java.lang.Iterable<? extends T2> second,
java.lang.Iterable<? extends T3> third,
java.lang.Iterable<? extends T4> fourth,
Function4<? super T,? super T2,? super T3,? super T4,? extends R> fn) |
default <U> Option<Tuple2<T,U>> |
zipWithPublisher(org.reactivestreams.Publisher<? extends U> other) |
orElseUse
arity, attemptMap, mapAsync, mapRetry, mapRetry, mapTry, mapTry
asSupplier, collect, fold, forEach, generate, iterate, iterator, mkString, newSubscriber, nonEmptyList, nonEmptyListGet, orElse, orElseGet, print, print, printErr, printOut, stream, subscribe, toEither, toLazyEither, toLeft, toOption, toOptional, toRight, toTry, toTry, toTry, transform
static final Option EMPTY
static <T> Option<T> attempt(CheckedSupplier<T> s)
default <R> Option<R> attemptFlatMap(java.util.function.Function<? super T,? extends Option<? extends R>> fn)
static <T,R> Option<R> tailRec(T initial, java.util.function.Function<? super T,? extends Option<? extends Either<T,R>>> fn)
static <T> Option<T> narrowK(Higher<DataWitness.option,T> opt)
static <T> Higher<DataWitness.option,T> widen(Option<T> narrow)
static <C2,T> Higher<C2,Higher<DataWitness.option,T>> widen2(Higher<C2,Option<T>> nestedMaybe)
static <T> Option<T> none()
static <T> Option<T> some(T value)
default <R> Option<R> concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
MonadicValue
Maybe.just(1).map(i->i+2).concatMap(i->Arrays.asList(()->i*3,20);
//Maybe[9]
concatMap
in interface MonadicValue<T>
mapper
- transformation functiondefault Option<T> orElseUse(Option<T> opt)
orElseUse
in interface OrElseValue<T,Option<T>>
default <R> Option<R> mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
MonadicValue
Future.ofResult(1).map(i->i+2).mergeMap(i->Flux.just(()->i*3,20);
//Future[9]
mergeMap
in interface MonadicValue<T>
mapper
- transformation functionstatic <T> Option<T> fromPublisher(org.reactivestreams.Publisher<T> pub)
ReactiveSeq<Integer> stream = ReactiveSeq.of(1,2,3);
Option<Integer> maybe = Option.fromPublisher(stream);
//Option[1]
pub
- Publisher to extract value fromstatic <T> Option<T> fromIterable(java.lang.Iterable<T> iterable)
ReactiveSeq<Integer> stream = ReactiveSeq.of(1,2,3);
Option<Integer> maybe = Option.fromIterable(stream);
//Option[1]
iterable
- Iterable to extract value fromstatic <R> Option<R> fromStream(java.util.stream.Stream<R> apply)
static <T> Option<T> fromOptional(java.util.Optional<T> opt)
Option<Integer> some = Option.fromOptional(Optional.of(10));
//Option[10], Some[10]
Option<Integer> none = Option.fromOptional(Optional.zero());
//Option.empty, None[]
opt
- Optional to construct Maybe fromdefault Trampoline<Maybe<T>> toTrampoline()
static <T> Option<T> of(T value)
some(Object)
Option<Integer> some = Option.of(10);
some.map(i->i*2);
value
- Value to wrap inside a Maybestatic <T> Option<T> ofNullable(T value)
Option<Integer> maybe = Option.ofNullable(null);
//None
Option<Integer> maybe = Option.ofNullable(10);
//Option[10], Some[10]
value
- static <T> Option<T> narrow(Option<? extends T> broad)
broad
- Maybe with covariant type parameterstatic <T> Option<ReactiveSeq<T>> sequenceJust(java.lang.Iterable<? extends Option<T>> maybes)
sequence(Iterable)
Option#none/ None types are
tolerated and ignored.
Option<Integer> just = Option.of(10);
Option<Integer> none = Option.none();
Option<Seq<Integer>> maybes = Option.sequenceJust(Seq.of(just, none, Option.of(1)));
//Option.of(Seq.of(10, 1));
maybes
- Option to Sequencestatic <T> Option<ReactiveSeq<T>> sequence(java.lang.Iterable<? extends Option<T>> maybes)
sequenceJust(Iterable)
if any Option types are None / zero
the return type will be an zero Option / None
Option<Integer> just = Option.of(10);
Option<Integer> none = Option.none();
Option<Seq<Integer>> maybes = Option.sequence(Seq.of(just, none, Option.of(1)));
//Option.none();
maybes
- Option to Sequencestatic <T> Option<ReactiveSeq<T>> sequence(java.util.stream.Stream<? extends Option<T>> maybes)
Maybe.sequenceJust(Iterable)
Option#zero/ None types are
result in the returned Maybe being Option.zero / None
Option<Integer> just = Option.of(10);
Option<Integer> none = Option.none();
Option<ReactiveSeq<Integer>> maybes = Option.sequence(Stream.of(just, none, Option.of(1)));
//Option.none();
maybes
- Option to Sequencestatic <T> Option<ReactiveSeq<T>> sequence(ReactiveSeq<? extends Option<T>> stream)
static <T,R> Option<ReactiveSeq<R>> traverse(java.util.function.Function<? super T,? extends R> fn, ReactiveSeq<Option<T>> stream)
static <T,R> Option<R> accumulateJust(java.lang.Iterable<Option<T>> maybes, Reducer<R,T> reducer)
Option<Integer> just = Option.of(10);
Option<Integer> none = Option.none();
Option<PersistentSetX<Integer>> maybes = Option.accumulateJust(Seq.of(just, none, Option.of(1)), Reducers.toPersistentSetX());
//Option.of(PersistentSetX.of(10, 1)));
maybes
- Maybes to accumulatereducer
- Reducer to accumulate values withstatic <T,R> Option<R> accumulateJust(java.lang.Iterable<Option<T>> maybes, java.util.function.Function<? super T,R> mapper, Monoid<R> reducer)
cyclops2.Monoids
..
Option<Integer> just = Option.of(10);
Option<Integer> none = Option.none();
Option<String> maybes = Option.accumulateJust(Seq.of(just, none, Option.of(1)), i -> "" + i,
SemigroupK.stringConcat);
//Option.of("101")
maybes
- Maybes to accumulatemapper
- Mapping function to be applied to the result of each Maybereducer
- Monoid to combine values from each Maybestatic <T> Option<T> accumulateJust(Monoid<T> reducer, java.lang.Iterable<Option<T>> maybes)
cyclops.Monoids
.
Option<Integer> maybes = Option.accumulateJust(Monoids.intSum,Seq.of(just, none, Option.of(1)));
//Option.of(11)
maybes
- Maybes to accumulatereducer
- Monoid to combine values from each Maybedefault <U> Option<Tuple2<T,U>> zipWithPublisher(org.reactivestreams.Publisher<? extends U> other)
zipWithPublisher
in interface Zippable<T>
default <S,U> Option<Tuple3<T,S,U>> zip3(java.lang.Iterable<? extends S> second, java.lang.Iterable<? extends U> third)
default <S,U,R> Option<R> zip3(java.lang.Iterable<? extends S> second, java.lang.Iterable<? extends U> third, Function3<? super T,? super S,? super U,? extends R> fn3)
default <T2,T3,T4> Option<Tuple4<T,T2,T3,T4>> zip4(java.lang.Iterable<? extends T2> second, java.lang.Iterable<? extends T3> third, java.lang.Iterable<? extends T4> fourth)
default <T2,T3,T4,R> Option<R> zip4(java.lang.Iterable<? extends T2> second, java.lang.Iterable<? extends T3> third, java.lang.Iterable<? extends T4> fourth, Function4<? super T,? super T2,? super T3,? super T4,? extends R> fn)
default <T2,R1,R2,R3,R> Option<R> forEach4(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1, java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2, Function3<? super T,? super R1,? super R2,? extends MonadicValue<R3>> value3, Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
MonadicValue
Maybe.of(3)
.forEach4(a->Maybe.just(a+10),
(a,b)->Maybe.just(a+b),
(a,b,c)->Maybe.none(),
(a,b,c,d)->a+b+c+d);
//Maybe.none
forEach4
in interface MonadicValue<T>
value1
- Nested MonadicValue to iterate overvalue2
- Nested MonadicValue to iterate overvalue3
- Nested MonadicValue to iterate overyieldingFunction
- Function with pointers to the current element from both
MonadicValue that generates the new elementsdefault <T2,R1,R2,R3,R> Option<R> forEach4(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1, java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2, Function3<? super T,? super R1,? super R2,? extends MonadicValue<R3>> value3, Function4<? super T,? super R1,? super R2,? super R3,java.lang.Boolean> filterFunction, Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
MonadicValue
Maybe.of(3)
.forEach4(a->Maybe.just(a+10),
(a,b)->Maybe.just(a+b),
(a,b,c)->Maybe.none(),
(a,b,c,d)->a+b+c<100,
(a,b,c,d)->a+b+c+d);
//Maybe.none
forEach4
in interface MonadicValue<T>
value1
- Nested MonadicValue to iterate overvalue2
- Nested MonadicValue to iterate overvalue3
- Nested MonadicValue to iterate overfilterFunction
- Filter to applyHKT over elements before passing non-filtered
values to the yielding functionyieldingFunction
- Function with pointers to the current element from both
MonadicValue that generates the new elementsdefault <T2,R1,R2,R> Option<R> forEach3(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1, java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2, Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
MonadicValue
Maybe.of(3)
.forEach3(a->Maybe.just(a+10),
(a,b)->Maybe.just(a+b),
(a,b,c)->a+b+c<100,
(a,b,c)->a+b+c);
//Maybe[32]
forEach3
in interface MonadicValue<T>
value1
- Nested MonadicValue to iterate overvalue2
- Nested MonadicValue to iterate overyieldingFunction
- Function with pointers to the current element from both
MonadicValue that generates the new elementsdefault <T2,R1,R2,R> Option<R> forEach3(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1, java.util.function.BiFunction<? super T,? super R1,? extends MonadicValue<R2>> value2, Function3<? super T,? super R1,? super R2,java.lang.Boolean> filterFunction, Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
MonadicValue
Maybe.of(3)
.forEach3(a->Maybe.just(a+10),
(a,b)->Maybe.just(a+b),
(a,b,c)->a+b+c<100,
(a,b,c)->a+b+c);
//Maybe[32]
forEach3
in interface MonadicValue<T>
value1
- Nested MonadicValue to iterate overvalue2
- Nested MonadicValue to iterate overfilterFunction
- Filter to applyHKT over elements before passing non-filtered
values to the yielding functionyieldingFunction
- Function with pointers to the current element from both
MonadicValue that generates the new elementsdefault <R1,R> Option<R> forEach2(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1, java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
MonadicValue
Maybe.of(3)
.forEach2(a->Maybe.none(),
(a,b)->a+b);
//Maybe.none()
forEach2
in interface MonadicValue<T>
value1
- Nested Monadic Type to iterate overyieldingFunction
- Function with pointers to the current element from both
monad types that generates the new elementsdefault <R1,R> Option<R> forEach2(java.util.function.Function<? super T,? extends MonadicValue<R1>> value1, java.util.function.BiFunction<? super T,? super R1,java.lang.Boolean> filterFunction, java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
MonadicValue
Maybe.of(3)
.forEach2(a->Maybe.none(),
a->b-> a<3 && b>10,
(a,b)->a+b);
//Maybe.none()
forEach2
in interface MonadicValue<T>
value1
- Nested monadic type to iterate overfilterFunction
- Filter to applyHKT over elements before passing non-filtered
values to the yielding functionyieldingFunction
- Function with pointers to the current element from both
Streams that generates the new elementsdefault <T2,R> Option<R> zip(java.lang.Iterable<? extends T2> app, java.util.function.BiFunction<? super T,? super T2,? extends R> fn)
Zippable
default <T2,R> Option<R> zip(java.util.function.BiFunction<? super T,? super T2,? extends R> fn, org.reactivestreams.Publisher<? extends T2> app)
Zippable
default <T> Option<T> unit(T unit)
Option<T> recover(java.util.function.Supplier<? extends T> value)
recover
in interface Recoverable<T>
<R> Option<R> map(java.util.function.Function<? super T,? extends R> mapper)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
map
in interface MonadicValue<T>
map
in interface Transformable<T>
mapper
- Transformation function<R> Option<R> flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper)
MonadicValue
Optional.flatMap(Function)
Eval.now(1).map(i->i+2).flatMap(i->Eval.later(()->i*3);
//Eval[9]
flatMap
in interface MonadicValue<T>
mapper
- transformation function<R> R fold(java.util.function.Function<? super T,? extends R> some, java.util.function.Supplier<? extends R> none)
Option<T> filter(java.util.function.Predicate<? super T> fn)
Filters
of(1,2,3).filter(i->i>2);
//[3]
default <U> Option<U> ofType(java.lang.Class<? extends U> type)
Filters
// (1, 2, 3) ReactiveSeq.of(1, "a", 2, "b",3).ofType(Integer.class)
default Option<T> filterNot(java.util.function.Predicate<? super T> fn)
Filters
of(1,2,3).filter(i->i>2);
//[1,2]
default Option<T> notNull()
Filters
of(1,2,null,4).nonNull();
//[1,2,4]
default Option<T> peek(java.util.function.Consumer<? super T> c)
Transformable
of(1,2,3).map(System.out::println)
1
2
3
peek
in interface Transformable<T>
c
- Consumer that recieves each element from this Transformabledefault <T1> Option<T1> emptyUnit()
static <T> Option<T> fromNullable(T t)