Martin Buchholz martinrb at
Tue Dec 10 01:50:25 UTC 2013

Current ConcurrentMap.forEach
has two different "specs" for the default method:

*Implementation Requirements:* The default implementation is equivalent to,
for this map:

 for (Map.Entry<K,V> entry : map.entrySet())
   action.accept(entry.getKey(), entry.getValue());

*Implementation Note:* The default implementation assumes that
IllegalStateException thrown by getKey() or getValue() indicates that the
entry no longer exists. Operation continues for subsequent entries.
But these are contradictory!  Furthermore, given that any Map might end up
giving us ISE, shouldn't we be using the ConcurrentMap implementation in
Map (and specifying the ISE-skipping behavior?)  Whether or not to skip ISE
should not be an Implementation Note, I think - it should be "spec".

More information about the core-libs-dev mailing list