Map Default Methods

Mike Duigou mike.duigou at oracle.com
Thu Apr 11 09:32:09 PDT 2013


Hi Doug;

I wanted to call your attention to three points in the the current ongoing review of the proposed Map default methods.

- 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'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.

- The retry behaviour of the compute(), computeIfPresent() and merge() defaults makes sense for concurrent maps but possibly not for non-concurrent maps. For non-concurrent maps the retry behaviour will mask concurrent usage errors. How do you feel about moving these defaults (along with computeIfAbsent()) to ConcurrentMap and providing implementations that generate ConcurrentModificationException for the Map defaults?

Thanks,

Mike


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