JDK-8157790 : java.util streams "filterNot(predicate)" for collections
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.stream
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2016-05-24
  • Updated: 2018-09-04
  • Resolved: 2016-11-03
Related Reports
Relates :  
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
filterNot api method for java streams

JUSTIFICATION :
filterNot can improve code readability and reduce excessiveness.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
strings.stream().filterNot(String::isEmpty)
ACTUAL -
strings.stream().filter((str) -> !str.isEmpty())


Comments
We should set the bar higher for adding operations to Stream. Setting the bar lower creates a precedent for adding other convenience-based operations and the Stream class and it can easily becomes out of control and set a poor example for other APIs (e.g. what about filtering specifically for Class, or what about takeWhileNot and dropWhileNot etc etc). IMO new operations should do something that is more significant in terms of functionality (e.g. such as takeWhile and dropWhile). The more general approach would be to focus on support in Predicate.
03-11-2016