4 ms·
Java can do that trivially easy for the stream case because there is only one input and one output. E.g. static <A, B, X> Function<A, X> compose(Function<A
by sumy23 4y ago
Java can do that trivially easy for the stream case because there is only one input and one output. E.g.
static <A, B, X> Function<A, X> compose(Function<A, B> one, Function<B, X> two) {
return (a) -> {
return two.apply(one.apply(a));
}
}
Java sucks when there are a variable number of generic arguments, so it struggles with the composition of two functions that have a variable number of inputs. That doesn't really apply to stream processing though.