hg: lambda/lambda/jdk: Docs.
Mike Duigou
mike.duigou at oracle.com
Fri Mar 22 10:29:36 PDT 2013
Using the iterator.remove() is the only safe way to incrementally remove items from a standard collection.
iter.remove() is fine, coll.remove(e) has the problem you describe.
Mike
On Mar 22 2013, at 10:14 , Paul Benedict wrote:
> I have a question on Collection.removeAll().
>
> The code is using iterator() to loop through the collection and remove()
> items. I thought it was best-practice (or almost a requirement) not to
> continue iterating through a collection once you remove() any item because
> collections are designed to fail-fast?
>
> Paul
>
> On Fri, Mar 22, 2013 at 11:59 AM, <paul.sandoz at oracle.com> wrote:
>
>> Changeset: 966eb5cf1944
>> Author: psandoz
>> Date: 2013-03-22 17:54 +0100
>> URL: http://hg.openjdk.java.net/lambda/lambda/jdk/rev/966eb5cf1944
>>
>> Docs.
>>
>> ! src/share/classes/java/util/Collection.java
>> ! src/share/classes/java/util/List.java
>> ! src/share/classes/java/util/Set.java
>> ! src/share/classes/java/util/SortedSet.java
>>
>>
>>
>
More information about the lambda-dev
mailing list