A
- The input Iterable element type, as well as the accumulation typepublic final class ReduceRight<A> extends Object implements Fn2<Fn2<? super A,? super A,? extends A>,Iterable<A>,Maybe<A>>
Iterable
<A>
and a Fn2
<A, A, A>
, iteratively
accumulate over the Iterable
, returning Maybe
<A>
. If the Iterable
is
empty, the result is Maybe.nothing()
; otherwise, the result is wrapped in Maybe.just(A)
. For this
reason, null
accumulation results are considered erroneous and will throw.
This function is isomorphic to a right fold over the Iterable
where the tail element is the starting
accumulation value and the result is lifted into Maybe
.
ReduceLeft
,
FoldRight
Modifier and Type | Method and Description |
---|---|
Maybe<A> |
checkedApply(Fn2<? super A,? super A,? extends A> fn,
Iterable<A> as) |
static <A> ReduceRight<A> |
reduceRight() |
static <A> Fn1<Iterable<A>,Maybe<A>> |
reduceRight(Fn2<? super A,? super A,? extends A> fn) |
static <A> Maybe<A> |
reduceRight(Fn2<? super A,? super A,? extends A> fn,
Iterable<A> as) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
apply, apply, checkedApply, compose, contraMap, curried, curry, diMapL, discardR, flip, fn2, fromBiFunction, toBiFunction, uncurry, widen