public interface ReduceM<T>
| Modifier and Type | Method and Description |
|---|---|
AnyM<T> |
reduceMCompletableFuture(Monoid<java.util.concurrent.CompletableFuture<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyM<T> |
reduceMIterable(Monoid<java.lang.Iterable<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyM<T> |
reduceMOptional(Monoid<java.util.Optional<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyM<T> |
reduceMStream(Monoid<java.util.stream.Stream<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyM<T> |
reduceMStreamable(Monoid<Streamable<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyM<T> reduceMOptional(Monoid<java.util.Optional<T>> reducer)
Monoid<Optional<Integer>> optionalAdd = Monoid.of(Optional.of(0), (a,b)-> Optional.of(a.get()+b.get()));
AnyM.fromStream(Stream.of(2,8,3,1)).reduceM(optionalAdd);
//AnyM[Optional(14)];
reducer - An identity value (approx. a seed) and BiFunction with a single type to reduce this anyMAnyM<T> reduceMStream(Monoid<java.util.stream.Stream<T>> reducer)
Monoid<Optional<Integer>> streamableAdd = Monoid.of(Stream.of(0), (a,b)-> Stream.of(a.get()+b.get()));
AnyM.fromStream(Stream.of(2,8,3,1)).reduceM(streamableAdd);
//AnyM[Optional(14)];
reducer - An identity value (approx. a seed) and BiFunction with a single type to reduce this anyMAnyM<T> reduceMStreamable(Monoid<Streamable<T>> reducer)
Monoid<Optional<Integer>> streamableAdd = Monoid.of(Streamable.of(0), (a,b)-> Streamable.of(a.get()+b.get()));
AnyM.fromStream(Stream.of(2,8,3,1)).reduceM(streamableAdd);
//AnyM[Optional(14)];
reducer - An identity value (approx. a seed) and BiFunction with a single type to reduce this anyMAnyM<T> reduceMIterable(Monoid<java.lang.Iterable<T>> reducer)
Monoid<Optional<Integer>> streamableAdd = Monoid.of(Streamable.of(0), (a,b)-> Streamable.of(a.get()+b.get()));
AnyM.fromStream(Stream.of(2,8,3,1)).reduceM(streamableAdd);
//AnyM[Optional(14)];
reducer - An identity value (approx. a seed) and BiFunction with a single type to reduce this anyMAnyM<T> reduceMCompletableFuture(Monoid<java.util.concurrent.CompletableFuture<T>> reducer)
Monoid<Optional<Integer>> streamableAdd = Monoid.of(CompletableFuture.completedFuture(0), (a,b)-> CompletableFuture.supplyAsync(()->a.get()+b.get()));
AnyM.fromStream(Stream.of(2,8,3,1)).reduceM(streamableAdd);
//AnyM[Optional(14)];
reducer - An identity value (approx. a seed) and BiFunction with a single type to reduce this anyM