public interface ApplyM<T>
Modifier and Type | Method and Description |
---|---|
<R> AnyM<R> |
applyMCompletableFuture(java.util.concurrent.CompletableFuture<java.util.function.Function<? super T,? extends R>> fn)
Apply function/s inside supplied Monad to data in current Monad
|
default <R> AnyM<R> |
applyMIterable(java.lang.Iterable<java.util.function.Function<? super T,? extends R>> fn)
Apply function/s inside supplied Monad to data in current Monad
e.g.
|
<R> AnyM<R> |
applyMOptional(java.util.Optional<java.util.function.Function<? super T,? extends R>> fn)
Apply function/s inside supplied Monad to data in current Monad
with Optionals
|
<R> AnyM<R> |
applyMStream(java.util.stream.Stream<java.util.function.Function<? super T,? extends R>> fn)
Apply function/s inside supplied Monad to data in current Monad
e.g.
|
<R> AnyM<R> applyMStream(java.util.stream.Stream<java.util.function.Function<? super T,? extends R>> fn)
AnyM<Integer> applied =AnyM.fromStream(Stream.of(1,2,3))
.applyM(Stream.of( (Integer a)->a+1 ,(Integer a) -> a*2));
assertThat(applied.toList(),equalTo(Arrays.asList(2, 2, 3, 4, 4, 6)));
fn
- Stream of Functions to applydefault <R> AnyM<R> applyMIterable(java.lang.Iterable<java.util.function.Function<? super T,? extends R>> fn)
AnyM<Integer> applied =AnyM.fromStream(Stream.of(1,2,3))
.applyM(Streamable.of( (Integer a)->a+1 ,(Integer a) -> a*2));
assertThat(applied.toList(),equalTo(Arrays.asList(2, 2, 3, 4, 4, 6)));
fn
- Iterable of Functions to apply<R> AnyM<R> applyMOptional(java.util.Optional<java.util.function.Function<? super T,? extends R>> fn)
Any<Integer> applied =AnyM.fromOptional(Optional.of(2)).applyM(AnyM.fromOptional(Optional.of( (Integer a)->a+1)) );
assertThat(applied.toList(),equalTo(Arrays.asList(3)));
fn
- <R> AnyM<R> applyMCompletableFuture(java.util.concurrent.CompletableFuture<java.util.function.Function<? super T,? extends R>> fn)
Any<Integer> applied =AnyM.fromOptional(Optional.of(2))..applyM(AnyM.fromCompletableFuture(CompletableFuture.completedFuture( (Integer a)->a+1)) );
assertThat(applied.toList(),equalTo(Arrays.asList(3)));
fn
-