map and null values

Doug Lea dl at
Thu Jan 3 07:40:51 PST 2013

On 01/03/13 09:57, Peter Levart wrote:
> And if there is a way to provide a single default
> implementation in j.u.Map that satisfies both ConcurrentMap implementations that
> don't allow nulls and plain Map implementations that allow nulls, why not
> provide it?

Feel free to try. The main constraint is that, to apply to
possibly-concurrent maps, the  four new function-accepting
methods must be expressed only in terms of putIfAbsent,
replace, and/or two-argument remove. While I haven't tried
to prove this, I believe that all ways of doing it encounter
the null ambiguity.


More information about the lambda-dev mailing list