RFR: CSR - JDK-8203428 Predicate::not (original) (raw)

Sundararajan Athijegannathan sundararajan.athijegannathan at oracle.com
Fri May 18 17:28:40 UTC 2018


Actually it would be:

 Predicate.of(String::isEmpty).negate()

But

 not(String::isEmpty) reads almost like !str.isEmpty()

-Sundar

On 18/05/18, 10:41 PM, Daniel Fuchs wrote:

Hi Jim,

Have you thought of introducing something like: static Predicate Predicate.of(Predicate target) { return target; } instead? I think that might allow you to do things like:

Stream.of("", "A", "b", "c") .filter(Predicate.of(String::isEmpty).not()) .filter(Predicate.of("a"::equalsIgnoreCase).or("b"::equalsIgnoreCase)) .count(); best regards, -- daniel On 18/05/2018 17:35, Jim Laskey wrote: Introduce a new static method Predicate::not which will allow developers to negate predicate lambdas trivially.

csr: https://bugs.openjdk.java.net/browse/JDK-8203428



More information about the core-libs-dev mailing list