A
- the element type this Monoid is formed overpublic interface Monoid<A> extends Semigroup<A>
Modifier and Type | Method and Description |
---|---|
default Monoid<A> |
flip()
Flip the order of the arguments.
|
default A |
foldLeft(A a,
Iterable<A> as)
Catamorphism under this semigroup using
FoldLeft , where the binary operator is this semigroup, and the
starting accumulator is provided. |
default <B> A |
foldMap(Fn1<? super B,? extends A> fn,
Iterable<B> bs)
Homomorphism combined with catamorphism.
|
default Lazy<A> |
foldRight(A a,
Iterable<A> as)
Catamorphism under this semigroup using
FoldRight , where the binary operator is this semigroup, and the
starting accumulator is provided. |
A |
identity()
The identity element of this monoid.
|
static <A> Monoid<A> |
monoid(Semigroup<A> semigroup,
A identity)
|
static <A> Monoid<A> |
monoid(Semigroup<A> semigroup,
Fn0<A> identityFn0) |
default A |
reduceLeft(Iterable<A> as)
Catamorphism under this monoid using
ReduceLeft , where the result is the reduction, or, if empty, the
identity of this monoid. |
default A |
reduceRight(Iterable<A> as)
Catamorphism under this monoid using
ReduceRight , where the result is the reduction, or, if empty, the
identity of this monoid. |
apply, apply, checkedApply, checkedApply, compose, contraMap, curried, curry, diMapL, discardR, fn2, fromBiFunction, toBiFunction, uncurry, widen
A identity()
default A reduceLeft(Iterable<A> as)
ReduceLeft
, where the result is the reduction, or, if empty, the
identity of this monoid.as
- the elements to reduceidentity()
if emptyReduceLeft
default A reduceRight(Iterable<A> as)
ReduceRight
, where the result is the reduction, or, if empty, the
identity of this monoid.as
- an Iterable of elements in this monoididentity()
if emptyReduceRight
default <B> A foldMap(Fn1<? super B,? extends A> fn, Iterable<B> bs)
Iterable<B>
to an
Iterable<A>
(that is, an Iterable
of elements this monoid is formed over), then
reduce the result from left to right. Under algebraic data types, this is isomorphic to a flatMap.B
- the input Iterable element typefn
- the mapping function from A to Bbs
- the Iterable of BsMap
,
reduceLeft(Iterable)
default A foldLeft(A a, Iterable<A> as)
FoldLeft
, where the binary operator is this semigroup, and the
starting accumulator is provided.default Lazy<A> foldRight(A a, Iterable<A> as)
FoldRight
, where the binary operator is this semigroup, and the
starting accumulator is provided.static <A> Monoid<A> monoid(Semigroup<A> semigroup, A identity)
A
- the element type of this monoidsemigroup
- the semigroupidentity
- the identity element