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>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) |
mapfold, fold, generate, iterate, mapReduce, mkString, newSubscriber, of, stream, subscribe, test, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFeatureToggle, toFutureStream, toFutureStream, toIor, toLazyImmutable, toListX, toMaybe, toMutable, toPBagX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toTry, toTry, toTry, toXor, toXor, unapply, visitendsWith, endsWithIterable, findAny, findFirst, firstValue, foldable, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, headAndTail, 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, visit, visit, xMatchfromSupplier, get, iterator, orElse, orElseGet, orElseThrow, toAtomicReference, toCompletableFuture, toCompletableFutureAsync, toCompletableFutureAsync, toFutureW, toList, toOptional, toOptionalAtomicReference, toStreamcast, 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)