java.util.function.Predicate
has some useful methods like and
, or
, etc. which are more concise than creating a bracket orgy with multiple logical operators. Unfortunately there seems to be no way to use these functions without actually having a Predicate explictely first...
Predicate<String> predicate = String::isEmpty;
Predicate<String> predicateWithAnd = predicate.and( MyClass::testSomething );
Is there a way to create the 2nd Predicate in only one statement (thus "saving" a variable), like...
Predicate<String> predicateWithAnd = (String::isEmpty).and( MyClass::testSomething ); // That doesn't seem to work ;-)
Just curious...