[concurrency-interest] Handling Null Values in ConcurrentHashMap

Joshua Bloch josh at bloch.us
Fri May 12 12:22:06 EDT 2006


On 5/12/06, Doug Lea <dl at cs.oswego.edu> wrote:

> Further digressing: I personally think that allowing
> nulls in Maps (also Sets) is an open invitation for programs
> to contain errors that remain undetected until
> they break at just the wrong time. (Whether to allow nulls even
> in non-concurrent Maps/Sets is one of the few design issues surrounding
> Collections that Josh Bloch and I have long disagreed about.)

I have moved towards your position over the years.  It was probably a
mistake to allow null keys in Maps and null elements in Sets.  I'm
still not sure about Map values and List elements.

In other words, Doug hates null more than I do, but over the years
I've come to see it as quite troublesome.


More information about the Concurrency-interest mailing list