RFR: CSR - JDK-8203428 Predicate::not

Daniel Fuchs daniel.fuchs at oracle.com
Fri May 18 17:11:37 UTC 2018


Hi Jim,

Have you thought of introducing something like:

static <T> Predicate<T> Predicate.of(Predicate<T> 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