Closed ajermakovics closed 9 years ago
There's Predicate.negate()
for that...
Sure, but it's not always convenient to use it. You have to cast your method reference to a Predicate. From SO question:
((Predicate<String>) String::isEmpty).negate()
could be made into more readable:
not(String::isEmpty)
I see. You're right, that could fit somewhere. I'll have to think about a more general strategy to integrate such utility methods... There's probably room for more
Guava has not
in a class called Predicates, so that could be one option.
I personally don't like to have dozens of classes all with their own static methods. I prefer having one single entry point for all sorts of DSL functionality. This has proven to be very effective with jOOQ, where all static SQL functions are available from org.jooq.impl.DSL
. The API learning curve is very slim.
Hello
Since there is no
not(Predicate)
function in Java 8: http://stackoverflow.com/q/21488056/1180621seems like it would be a useful addition to jOOL.