-
Notifications
You must be signed in to change notification settings - Fork 51
Wrappers : Monoid
johnmcclean-aol edited this page Feb 24, 2016
·
3 revisions
Cyclops has merged with simple-react. Please update your bookmarks (stars :) ) to https://github.com/aol/cyclops-react
All new develpoment on cyclops occurs in cyclops-react. Older modules are still available in maven central.
com.aol.cyclops.lambda.api.Monoid is a generic interface that can define or wrap around a Monoid ( implementations are provided by libraries such as Functional Java or can be created via Monoid.of).
Monoids can be coerced to the generic Monoid interface via
- AsMonoid.asMonoid
- As.asMonoid
com.aol.cyclops.lambda.api.Monoid provides
The monoid methods / functions
- zero
- combiner()
And
- reduce : reduce a Stream - the method signature of Stream.reduce is a monoid
- mapReduce : maps to appropriate type before reduction
Provide a generic way to define and reuse Monoids in Java (principally for Stream Reduction).