T - public interface Applicativable<T> extends ConvertableFunctor<T>, Unit<T>
| Modifier and Type | Interface and Description |
|---|---|
static class |
Applicativable.Applicatives |
static class |
Applicativable.SemigroupApplyer<T> |
Value.ValueImpl<T>Matchable.AsMatchable, Matchable.AutoCloseableMatchableIterable<TYPE>, Matchable.CheckValue1<T,R>, Matchable.CheckValue2<T1,T2,R>, Matchable.CheckValue3<T1,T2,T3,R>, Matchable.CheckValue4<T1,T2,T3,T4,R>, Matchable.CheckValue5<T1,T2,T3,T4,T5,R>, Matchable.CheckValueOpt<T,R>, Matchable.CheckValues<T,R>, Matchable.MatchableIterable<TYPE>, Matchable.MatchableObject<TYPE>, Matchable.MatchableOptional<T>, Matchable.MatchSelf<TYPE>, Matchable.MTuple1<T1>, Matchable.MTuple2<T1,T2>, Matchable.MTuple3<T1,T2,T3>, Matchable.MTuple4<T1,T2,T3,T4>, Matchable.MTuple5<T1,T2,T3,T4,T5>, Matchable.MXor<T1,T2>, Matchable.ValueAndOptionalMatcher<T>Convertable.SupplierToConvertable<T>| Modifier and Type | Method and Description |
|---|---|
default Applicativable.SemigroupApplyer<T> |
ap(java.util.function.BiFunction<T,T,T> fn)
Apply the provided function to combine multiple different Applicatives, wrapping the same type.
|
default Applicativable.SemigroupApplyer<T> |
ap(Semigroup<T> fn) |
default <R> Applicativable<R> |
ap1(java.util.function.Function<? super T,? extends R> fn) |
default <T2,R> Applicative<T2,R,?> |
ap2(java.util.function.BiFunction<? super T,? super T2,? extends R> fn)
Apply the provided function to two different Applicatives.
|
default <T2,T3,R> Applicative2<T2,T3,R,?> |
ap3(TriFunction<? super T,? super T2,? super T3,? extends R> fn) |
default <T2,T3,T4,R> |
ap4(QuadFunction<? super T,? super T2,? super T3,? super T4,? extends R> fn) |
default <T2,T3,T4,T5,R> |
ap5(QuintFunction<? super T,? super T2,? super T3,? super T4,? super T5,? extends R> fn) |
mapconvertTo, convertToAsync, fold, fold, generate, getMatchable, iterate, mapReduce, mkString, newSubscriber, of, stream, subscribe, test, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFutureStream, toFutureStream, toIor, toLazyImmutable, toListX, toMaybe, toMutable, toPBagX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toTry, toTry, toXor, unapplyfoldRight, foldRight, foldRight, foldRightMapToType, join, join, join, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reducefrom, from, from, from, from, from, from, from, from, from, fromCharSequence, fromIterable, fromOptional, listOfValues, ofDecomposable, otherwise, otherwise, then, then, when, when, when, when, when, when, when, when, when, when, whenGuard, whenTrue, whenValuesfromSupplier, get, iterator, orElse, orElseGet, orElseThrow, toAtomicReference, toCompletableFuture, toCompletableFutureAsync, toCompletableFutureAsync, toFutureW, toList, toOptional, toOptionalAtomicReference, toStream, visitcast, patternMatch, peek, trampolinedefault Applicativable.SemigroupApplyer<T> ap(java.util.function.BiFunction<T,T,T> fn)
Xor<String,String> fail1 = Xor.secondary("failed1");
fail1.swap().ap(Semigroups.stringConcat)
.ap(Xor.secondary("failed2").swap())
.ap(Xor.<String,String>primary("success").swap()
.
// [failed1failed2]
fn - default Applicativable.SemigroupApplyer<T> ap(Semigroup<T> fn)
default <R> Applicativable<R> ap1(java.util.function.Function<? super T,? extends R> fn)
default <T2,R> Applicative<T2,R,?> ap2(java.util.function.BiFunction<? super T,? super T2,? extends R> fn)
public int add(Integer a,Integer b){
return a+b;
}
We can add two Applicative types together without unwrapping the values
Maybe.of(10).ap2(this::add).ap(Maybe.of(20))
//Maybe[30];
fn - default <T2,T3,R> Applicative2<T2,T3,R,?> ap3(TriFunction<? super T,? super T2,? super T3,? extends R> fn)
default <T2,T3,T4,R> Applicative3<T2,T3,T4,R,?> ap4(QuadFunction<? super T,? super T2,? super T3,? super T4,? extends R> fn)
default <T2,T3,T4,T5,R> Applicative4<T2,T3,T4,T5,R,?> ap5(QuintFunction<? super T,? super T2,? super T3,? super T4,? super T5,? extends R> fn)