public interface ReduceM<T>
Modifier and Type | Method and Description |
---|---|
AnyMValue<T> |
reduceMCompletableFuture(Monoid<java.util.concurrent.CompletableFuture<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyMValue<T> |
reduceMEval(Monoid<Eval<T>> reducer) |
AnyMSeq<T> |
reduceMIterable(Monoid<java.lang.Iterable<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyMValue<T> |
reduceMMaybe(Monoid<Maybe<T>> reducer) |
AnyMValue<T> |
reduceMOptional(Monoid<java.util.Optional<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyMSeq<T> |
reduceMStream(Monoid<java.util.stream.Stream<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyMSeq<T> |
reduceMStreamable(Monoid<Streamable<T>> reducer)
Perform a reduction where NT is a (native) Monad type
e.g.
|
AnyMValue<T> |
reduceMXor(Monoid<Xor<?,T>> reducer) |
AnyMValue<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 anyMAnyMSeq<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 anyMAnyMSeq<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 anyMAnyMSeq<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 anyMAnyMValue<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