T
- Data type of element stored inside this MonadicValue1public interface MonadicValue1<T> extends MonadicValue<T>
Value.ValueImpl<T>
Convertable.SupplierToConvertable<T>
Modifier and Type | Method and Description |
---|---|
default AnyMValue<T> |
anyM() |
default <R> MonadicValue<R> |
coflatMap(java.util.function.Function<? super MonadicValue<T>,R> mapper)
Perform a coflatMap operation.
|
default MonadicValue1<T> |
combineEager(Monoid<T> monoid,
MonadicValue<? extends T> v2)
Eagerly combine two MonadicValues using the supplied monoid (@see ApplicativeFunctor for type appropraite i.e.
|
<R> MonadicValue<R> |
flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper)
A flattening transformation operation (@see
Optional.flatMap(Function) |
default <R> MonadicValue<R> |
flatMapIterable(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 <R> MonadicValue<R> |
flatMapPublisher(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.
|
<R> MonadicValue<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Transform this functor using the supplied transformation function
|
<T> MonadicValue1<T> |
unit(T unit) |
nest
collect, fold, fold, generate, iterate, iterator, mapReduce, mkString, newSubscriber, of, stream, subscribe, test, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFeatureToggle, toFutureStream, toFutureStream, toIor, toLazyImmutable, toList, toListX, toMaybe, toMutable, toPBagX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toTry, toTry, toTry, toXor, toXor, unapply
endsWith, endsWithIterable, findAny, findFirst, firstValue, foldable, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, join, join, join, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, startsWith, startsWithIterable, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, validate, xMatch
collect, fromSupplier, get, isPresent, orElse, orElseGet, orElseThrow, toAtomicReference, toCompletableFuture, toCompletableFutureAsync, toCompletableFutureAsync, toFutureW, toFutureWAsync, toFutureWAsync, toOptional, toOptionalAtomicReference, toStream, visit
cast, patternMatch, peek, trampoline
<T> MonadicValue1<T> unit(T unit)
<R> MonadicValue<R> map(java.util.function.Function<? super T,? extends R> fn)
Functor
of(1,2,3).map(i->i*2)
//[2,4,6]
default AnyMValue<T> anyM()
anyM
in interface MonadicValue<T>
default <R> MonadicValue<R> coflatMap(java.util.function.Function<? super MonadicValue<T>,R> mapper)
MonadicValue
Maybe.none().coflatMap(m -> m.isPresent() ? m.get() : 10);
//Maybe[10]
coflatMap
in interface MonadicValue<T>
mapper
- Mapping / transformation functiondefault MonadicValue1<T> combineEager(Monoid<T> monoid, MonadicValue<? extends T> v2)
Monoid<Integer> add = Monoid.of(1,Semigroups.intSum);
Maybe.of(10).combineEager(add,Maybe.none());
//Maybe[10]
Maybe.none().combineEager(add,Maybe.of(10));
//Maybe[10]
Maybe.none().combineEager(add,Maybe.none());
//Maybe.none()
Maybe.of(10).combineEager(add,Maybe.of(10));
//Maybe[20]
Monoid<Integer> firstNonNull = Monoid.of(null , Semigroups.firstNonNull());
Maybe.of(10).combineEager(firstNonNull,Maybe.of(10));
//Maybe[10]
monoid
- v2
- <R> MonadicValue<R> flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper)
Optional.flatMap(Function)
Eval.now(1).map(i->i+2).flatMap(i->Eval.later(()->i*3);
//Eval[9]
mapper
- transformation functiondefault <R> MonadicValue<R> flatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
Maybe.just(1).map(i->i+2).flatMapIterable(i->Arrays.asList(()->i*3,20);
//Maybe[9]
mapper
- transformation functiondefault <R> MonadicValue<R> flatMapPublisher(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
FutureW.ofResult(1).map(i->i+2).flatMapPublisher(i->Flux.just(()->i*3,20);
//FutureW[9]
mapper
- transformation function