T
- public interface WrappingFunctor<T> extends Functor<T>
Modifier and Type | Method and Description |
---|---|
default java.lang.Object |
getFunctor()
Override this method if you are using this class to wrap a Functor that does not
implement this interface natively.
|
default <R> WrappingFunctor<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Transform this functor using the supplied transformation function
|
default WrappingFunctor<T> |
peek(java.util.function.Consumer<? super T> c)
Peek at the current value of this Functor, without transforming it
|
default <X> X |
unwrap() |
default <T> WrappingFunctor<T> |
withFunctor(T functor)
Will attempt to create a new instance of this functor type via constructor reflection
if this is a wrapped Functor (i.e.
|
cast, patternMatch, trampoline
default <T> WrappingFunctor<T> withFunctor(T functor)
functor
- default java.lang.Object getFunctor()
default <R> WrappingFunctor<R> map(java.util.function.Function<? super T,? extends R> fn)
Functor
of(1,2,3).map(i->i*2)
//[2,4,6]
default WrappingFunctor<T> peek(java.util.function.Consumer<? super T> c)
Functor
of(1,2,3).map(System.out::println)
1
2
3
default <X> X unwrap()