
jedi.functors.ComposeableFunctor2 Maven / Gradle / Ivy
The newest version!
package jedi.functors;
import jedi.functional.Functor;
import jedi.functional.Functor2;
public class ComposeableFunctor2 implements Functor2 {
private final Functor2 functor;
public ComposeableFunctor2(final Functor2 functor) {
this.functor = functor;
}
public R execute(final T t, final U u) {
return functor.execute(t, u);
}
/**
* Function composition: this.andThen(g) applied to (t, u) == g(this.execute(t, u))
*/
public ComposeableFunctor2 andThen(final Functor super R, NEW_R> g) {
return new ComposeableFunctor2(new Functor2() {
public NEW_R execute(T t, U u) {
return g.execute(functor.execute(t, u));
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy