Hi everyone,

I'm a first timer here, I just joined the group as suggested by Martijn
Verburg to make a suggestion for a slight change in the implementation of
Collections.EMPTY_MAP.

If I understand correctly, this class represents an immutable empty map. As
a result, operations like put or remove have been implemented to throw
UnsupportedOperationException; this makes sense to me. However, this is
also the implementation for computeIfPresent, which I believe may be too
disruptive: the definition of this method says “If the value for the
specified key is present and non-null, attempts to compute a new mapping
given the key and its current mapped value.“; for an empty map, this could
be a safe no-op, instead of an exception.

I was wondering if this is something that would make sense to there people
too (feedback appreciated). If so, I'm happy to provide a patch for the
change (we just need to leave an empty body for the method).

Please let me know what you think,

Cheers,
Abraham

Reply via email to