public static class Maybe.Nothing<T> extends java.lang.Object implements Maybe<T>
Maybe.CompletableMaybe<ORG,T2>, Maybe.Instances, Maybe.Just<T>, Maybe.Lazy<T>, Maybe.Nothing<T>Value.ValueImpl<T>Convertable.SupplierToConvertable<T>Fn0.FunctionalOperations<R>, Fn0.SupplierKind<R>| Constructor and Description |
|---|
Nothing() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
Maybe<T> |
filter(java.util.function.Predicate<? super T> test)
Keep only elements for which the supplied predicates hold
e.g.
|
<R> Maybe<R> |
flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper)
A flattening transformation operation (@see
Optional.flatMap(Function) |
<R> Maybe.Nothing<R> |
flatMapI(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.
|
<R> Maybe.Nothing<R> |
flatMapP(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.
|
void |
forEach(java.util.function.Consumer<? super T> action) |
T |
get() |
boolean |
isPresent() |
<R> Maybe<R> |
map(java.util.function.Function<? super T,? extends R> mapper)
Transform this functor using the supplied transformation function
|
T |
orElse(T value)
Get the contained value or else the provided alternative
|
T |
orElseGet(java.util.function.Supplier<? extends T> value)
An equivalent operation to
Optional.orElseGet(Supplier)
Returns a value generated by the provided Supplier if this Convertable is zero or
contains a null value. |
Maybe<T> |
recover(java.util.function.Supplier<? extends T> value) |
Maybe<T> |
recover(T value) |
Maybe<T> |
recoverWith(java.util.function.Supplier<? extends Maybe<T>> fn) |
java.util.Optional<T> |
toOptional() |
java.lang.String |
toString() |
<R> R |
visit(java.util.function.Function<? super T,? extends R> some,
java.util.function.Supplier<? extends R> none)
The provided function is executed with the value stored in this Visitable if one is present,
otherwise the provided Supplier is executed instead.
|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaccumulateJust, accumulateJust, accumulateJust, allTypeclasses, anyM, arrow, async, cast, coflatMap, combine, combineEager, coproduct, filterNot, flatMapS, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, fromEval, fromEvalNullable, fromEvalOf, fromEvalOptional, fromFuture, fromIterable, fromLazy, fromOptional, fromOptional, fromOptionalKind, fromPublisher, fromStream, just, kindCokleisli, kindKleisli, liftM, mapM, maybe, narrow, narrowK, narrowOptional, nest, nested, none, notNull, of, ofNullable, ofType, peek, product, retry, retry, sequence, sequence, sequenceJust, toMaybe, toTrampoline, trampoline, unit, widen, widen2, zip, zip, zip, zip3, zip3, zip4, zip4, zipP, zipP, zipS, zipS, zipWith, zipWithP, zipWithSarityapply, generate, iterate, iterator, mkString, newSubscriber, stream, subscribe, test, toEither, toEval, toEvalAlways, toEvalLater, toEvalNow, toIor, toLeft, toMaybeEager, toRight, toTry, toTry, toTry, toXor, toXorendsWith, endsWithIterable, findAny, findFirst, firstValue, foldLeft, foldLeft, foldLeft, foldLeft, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, join, join, join, mapReduce, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleUnsafe, startsWith, startsWithIterable, takeOne, xMatchcollect, fromSupplier, orElseThrow, toCompletableFuture, toCompletableFutureAsync, toFuture, toFutureAsync, toStreampublic <R> Maybe<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 Transformable<T>map in interface MonadicValue<T>map in interface Maybe<T>mapper - Transformation functionpublic <R> Maybe<R> flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper)
MonadicValueOptional.flatMap(Function)
Eval.now(1).map(i->i+2).flatMap(i->Eval.later(()->i*3);
//Eval[9]
public Maybe<T> filter(java.util.function.Predicate<? super T> test)
Filters
of(1,2,3).filter(i->i>2);
//[3]
public T get()
get in interface Convertable<T>get in interface java.util.function.Supplier<T>public Maybe<T> recoverWith(java.util.function.Supplier<? extends Maybe<T>> fn)
recoverWith in interface Maybe<T>public <R> R visit(java.util.function.Function<? super T,? extends R> some, java.util.function.Supplier<? extends R> none)
Visitablevisit in interface Convertable<T>visit in interface Visitable<T>visit in interface Maybe<T>some - Function to execute if this Visitable has a valuenone - Supplier to execute if this Visitable does not have a Valuepublic java.util.Optional<T> toOptional()
toOptional in interface Convertable<T>public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isPresent()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic T orElse(T value)
ConvertableorElse in interface Convertable<T>public T orElseGet(java.util.function.Supplier<? extends T> value)
ConvertableOptional.orElseGet(Supplier)
Returns a value generated by the provided Supplier if this Convertable is zero or
contains a null value.orElseGet in interface Convertable<T>value - Supplier to generate value if this convertable is zeropublic <R> Maybe.Nothing<R> flatMapI(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
MonadicValue
Maybe.just(1).map(i->i+2).flatMapI(i->Arrays.asList(()->i*3,20);
//Maybe[9]
public <R> Maybe.Nothing<R> flatMapP(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
MonadicValue
Future.ofResult(1).map(i->i+2).flatMapP(i->Flux.just(()->i*3,20);
//Future[9]