RFR 8005704: Update ConcurrentHashMap to v8

Doug Lea dl at cs.oswego.edu
Tue May 28 10:29:11 UTC 2013

On 05/27/13 10:30, Chris Hegarty wrote:

> 1) CHM no longer extends AbstractMap. I guess this should not be a
>     problem in the real world, and I guess users would not be too
>     surprised by instanceof checks. Just worth highlighting the change
>     for compatibility.

Yes, thanks. It was a bad idea to extend AbstractMap in the first place,
since all of its methods are or should be overridden. But if
there is any reason to retain this, it is harmless to do so,
at the expense of adding two unused fields to footprint.
(The AbstractMap keySet and Values fields cannot be used
by CHM because they are package-protected, so it needs to
declare its own versions anyway.)

> 4) Does is make sense for KeySetView to be Serializable? It looks a
>     little odd with value as its only field.

(Plus the backing ConcurrentHashMap.)
Serialization is needed (or at least desired) because this class
is now used for CHM.newKeySet, which finally adds a way to
get the equivalent of a ConcurrentHashSet. (You could get one
via Collections.newSetFromMap, but then lose the advertised
concurrency/atomicity properties.)


More information about the core-libs-dev mailing list