I've only seen examples such as the following for composing functions (or people using lambdas).
Function<A,B> inner = ....;
Function<B,C> outter = ....;
Function<A,C> result = outter.compose(inner);
I would like to compose the following functions using the "compose" feature and not just invoking them directly.
public class J{
public static B inner(final A a){...}
public static C outter(final B b){...}
}
public class K{
public static Function<A,C> result = (J::outter).compose(J::inner);
}
This doesn't compile. I can't seem to be able to use that "compose" member of java.util.function.Function. How do I do it for traditionally declared functions? I would like to avoid the following:
public class K{
public static Function<A,C> result = (a)-> J.outter(J.inner(a));
}
Can it be done?? Thanks in advance