return type of Collection.removeIf

Stephen Colebourne scolebourne at joda.org
Mon Apr 29 03:08:10 PDT 2013


On 29 April 2013 10:41, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> On Apr 21, 2013, at 6:06 AM, Akhil Arora <akhil.arora at oracle.com> wrote:
>> Collection.removeIf is currently specified to return a boolean which is
>> true if any elements were removed. IMHO it would be more useful to have
>> it return an int indicating the number of elements that were removed.
>
> But i think it may be best to stick with the existing semantics of existing bulk operations such as:

I don't see any harm with returning more information here (an int).
The return type of remove is probbaly only used in a small number of
cases anyway, so I don't think consistency is a big deal either.

Stephen


More information about the lambda-dev mailing list