RFR : 8016446 : (m) Add override forEach/replaceAll to HashMap, Hashtable, IdentityHashMap, WeakHashMap, TreeMap

Remi Forax forax at univ-mlv.fr
Thu Jun 13 08:15:55 UTC 2013


On 06/13/2013 09:51 AM, Paul Sandoz wrote:
> On Jun 13, 2013, at 7:28 AM, Mike Duigou <mike.duigou at oracle.com> wrote:
>
>> I have updated my webrev with Remi's improvements and some other improvements to the fast-fail concurrent modification checking.
>>
>> Revised webrev:
>>
>> http://cr.openjdk.java.net/~mduigou/JDK-8016446/1/webrev/
>>
> The approach we have taken for bulk traversal of fail-fast spliterators and ArrayList/Vector is to check the mod count at the end of the loop. I think we should be consistent with those.
>
> Paul.

Hi Paul,
ArrayList.forEach() does the modCount check at each step.
There is a difference between an Iterator/forEach and a spliterator/stream,
with a stream you know that the called lambdas will not interfere and 
mutate the source collection.

Rémi




More information about the core-libs-dev mailing list