RFR: CSR - JDK-8203428 Predicate::not (original) (raw)
Sundararajan Athijegannathan sundararajan.athijegannathan at oracle.com
Fri May 18 17:28:40 UTC 2018
- Previous message: RFR: CSR - JDK-8203428 Predicate::not
- Next message: RFR: CSR - JDK-8203428 Predicate::not
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Previous message: RFR: CSR - JDK-8203428 Predicate::not
- Next message: RFR: CSR - JDK-8203428 Predicate::not
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]