In Guava, we can do things like
Predicate<String> isEmpty = Predicates.compose(String::length, Integer.valueOf(0)::equals);
Is it possible to do something like this in Java 8? for instance
Predicate<Integer> isZero = Integer.valueOf(0)::equals;
Predicate<String> isEmpty = isZero.compose(String::length);
or a library function that is reachable in the same way?
Please note that I am not asking how to do this myself ( s -> isZero.test(s.length)works fine) or why it doesn't work on line (Lambda types are output and all that)
source
share