The Stream#filter method is commonly used with a negated operation, which requires using the negation operator ! and prevents shortening code with method references. I propose the introduction of Stream#filterNot to eliminate this issue.
A simple implementation and use case may be as follows:
// one.util.streamex.AbstractStreamEx
public S filterNot(Predicate<? super T> predicate) {
return filter(predicate.negate());
}
The
Stream#filter
method is commonly used with a negated operation, which requires using the negation operator!
and prevents shortening code with method references. I propose the introduction ofStream#filterNot
to eliminate this issue.A simple implementation and use case may be as follows: