public static class Maybe.CompletableMaybe<ORG,T2> extends java.lang.Object implements Maybe<T2>, Completable<ORG>
Maybe.CompletableMaybe<ORG,T2>, Maybe.Comprehensions, Maybe.Just<T>, Maybe.Lazy<T>, Maybe.Nothing<T>
Option.None<T>, Option.Some<T>
Modifier and Type | Field and Description |
---|---|
java.util.concurrent.CompletableFuture<ORG> |
complete |
Maybe<T2> |
maybe |
Constructor and Description |
---|
CompletableMaybe() |
Modifier and Type | Method and Description |
---|---|
boolean |
complete(ORG done) |
boolean |
completeAsNone() |
boolean |
completeExceptionally(java.lang.Throwable error) |
boolean |
equals(java.lang.Object obj) |
Maybe<T2> |
filter(java.util.function.Predicate<? super T2> fn)
Keep only elements for which the supplied predicates hold
e.g.
|
<R> Maybe<R> |
flatMap(java.util.function.Function<? super T2,? extends MonadicValue<? extends R>> mapper)
A flattening transformation operation (@see
Optional.flatMap(Function) |
<R> R |
fold(java.util.function.Function<? super T2,? extends R> fn1,
java.util.function.Function<? super Option.None<T2>,? extends R> fn2) |
<R> R |
fold(java.util.function.Function<? super T2,? extends R> some,
java.util.function.Supplier<? extends R> none) |
int |
hashCode() |
boolean |
isDone() |
boolean |
isFailed() |
boolean |
isPresent() |
<R> Maybe<R> |
map(java.util.function.Function<? super T2,? extends R> mapper)
Transform this functor using the supplied transformation function
|
Maybe<T2> |
recover(java.util.function.Supplier<? extends T2> value) |
Maybe<T2> |
recover(T2 value) |
Maybe<T2> |
recoverWith(java.util.function.Supplier<? extends Option<T2>> fn) |
void |
subscribe(org.reactivestreams.Subscriber<? super T2> sub) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
accumulateJust, accumulateJust, accumulateJust, arrow, async, attempt, attemptFlatMap, attemptMap, concatMap, eager, filterNot, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, fromEval, fromEvalNullable, fromEvalOf, fromEvalOptional, fromFuture, fromIterable, fromLazy, fromLazyOption, fromOption, fromOptional, fromPublisher, fromStream, just, lazy, maybe, mergeMap, narrow, narrowK, narrowOptional, nothing, notNull, of, ofNullable, ofType, orElseUse, peek, sequence, sequence, sequence, sequenceJust, tailRec, toMaybe, toTrampoline, traverse, unit, widen, widen2, zip, zip, zip, zip3, zip3, zip4, zip4, zipWithPublisher
accumulateJust, accumulateJust, accumulateJust, emptyUnit, fromNullable, fromStream, narrow, none, sequence, sequence, sequence, sequenceJust, some, tailRec, traverse, widen, widen2
orElseUse
arity, mapAsync, mapRetry, mapRetry, mapTry, mapTry
asSupplier, collect, fold, forEach, generate, iterate, iterator, mkString, nonEmptyList, nonEmptyListGet, orElse, orElseGet, print, print, printErr, printOut, stream, toEither, toLazyEither, toLeft, toOption, toOptional, toRight, toTry, toTry, toTry
public final java.util.concurrent.CompletableFuture<ORG> complete
public boolean isPresent()
public Maybe<T2> recoverWith(java.util.function.Supplier<? extends Option<T2>> fn)
recoverWith
in interface Maybe<T2>
recoverWith
in interface Option<T2>
public <R> Maybe<R> map(java.util.function.Function<? super T2,? extends R> mapper)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
public <R> Maybe<R> flatMap(java.util.function.Function<? super T2,? extends MonadicValue<? extends R>> mapper)
MonadicValue
Optional.flatMap(Function)
Eval.now(1).map(i->i+2).flatMap(i->Eval.later(()->i*3);
//Eval[9]
public <R> R fold(java.util.function.Function<? super T2,? extends R> some, java.util.function.Supplier<? extends R> none)
public Maybe<T2> filter(java.util.function.Predicate<? super T2> fn)
Filters
of(1,2,3).filter(i->i>2);
//[3]
filter
in interface Filters<T2>
filter
in interface MonadicValue<T2>
filter
in interface Maybe<T2>
filter
in interface Option<T2>
fn
- to filter elements by, retaining matchespublic boolean isFailed()
isFailed
in interface Completable<ORG>
public boolean isDone()
isDone
in interface Completable<ORG>
public boolean completeAsNone()
public boolean complete(ORG done)
complete
in interface Completable<ORG>
public boolean completeExceptionally(java.lang.Throwable error)
completeExceptionally
in interface Completable<ORG>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public <R> R fold(java.util.function.Function<? super T2,? extends R> fn1, java.util.function.Function<? super Option.None<T2>,? extends R> fn2)
fold
in interface Sealed2<T2,Option.None<T2>>