How to negate a method reference predicate
https://stackoverflow.com/questions/21488056/how-to-negate-a-method-reference-predicate
public static <T> Predicate<T> not(Predicate<T> t) {
return t.negate();
}
Stream<String> s = ...;
long nonEmptyStrings = s.filter(not(String::isEmpty)).count();
网友评论