RFR: 8023339 : (xs) Rename Collection.removeIf(Predicate) to removeAll(Predicate)

Brian Goetz brian.goetz at oracle.com
Sat Sep 7 22:11:11 UTC 2013


> One of the main consequences of how lambda matching rules
> panned out is that  it is in general a bad idea to overload any
> method accepting a lambda.

It is only a bad idea to overload methods that take same-arity lambdas 
in the same position.

   removeAll(Collection)
vs
   removeAll(Predicate)

are fine (in part because null is an invalid value for both.)

> I imagine that most tutorials etc
> about designing with lambda will present this as the first
> rule of thumb.

Dan has some rules about what constitutes valid and invalid 
overloadings, that have gone through a few rounds of simplification and 
are finally (especially with the recent overloading simplifications in 
the spec) that should be pretty easy to internalize.




More information about the core-libs-dev mailing list