Map Default Methods

Doug Lea dl at cs.oswego.edu
Thu Apr 11 10:31:19 PDT 2013


On 04/11/13 12:32, Mike Duigou wrote:

> - I've added an additional default getOrDefault() to ConcurrentMap which preserves the atomic behaviour of ConcurrentMap at the cost of not supporting null values in maps.
>

I suppose this is OK. As mentioned in some list discussion, the
unfortunate part is that ConcurrentMap does not explicitly ban
null either. So all this does is push the issue one level deeper.

On the other hand, all known implementations ban nulls because it
would be  stupid to support them -- for example putIfAbsent is
useless is such cases. So the on-paper issue doesn't have any
interesting impact.


> - I've changed the method documentation warning regarding synchronization, atomicity, concurrency. Please ensure that it still matches your intent:
>
>       * <p>The default implementation makes no guarantees about synchronization
>       * or atomicity properties of this method. Any class which wishes to provide
>       * specific synchronization, atomicity or concurrency behaviour should
>       * override this method.
>

Change to to avoid wishery:

... Any implementation providing atomicity guarantees must override this method
and document its concurrency properties.

-Doug





More information about the lambda-libs-spec-experts mailing list