RFR: 8004518 & 8010122 : Default methods on Map
Ulf Zibis
Ulf.Zibis at CoSoCo.de
Wed Apr 10 09:25:02 UTC 2013
Hi again,
please consider to add hash() to interface Map, as an additional performance opportunity, see:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6812862
It was rejected with:
implement a wrapper class for the "key" to customize its hash() & equals() methods
Unfortunately my earlier comment on this appears to be lost by migration to Jira, so here again:
Instantiating a wrapper object for each key contradicts the purpose of performance tuning and
additionally increases memory footprint.
-Ulf
Am 08.04.2013 20:07, schrieb Mike Duigou:
> Hello all;
>
> This is a combined review for the new default methods on the java.util.Map interface being added for the JSR-335 lambda libraries. The reviews are being combined because they share a common unit test.
>
> http://cr.openjdk.java.net/~mduigou/JDK-8010122/0/webrev/
>
> 8004518: Add in-place operations to Map
> forEach()
> replaceAll()
>
> 8010122: Add atomic operations to Map
> getOrDefault()
> putIfAbsent() *
> remove(K, V)
> replace(K, V)
> replace(K, V, V)
> compute() *
> merge() *
> computeIfAbsent() *
> computeIfPresent() *
>
> The * operations treat null values as being absent. (ie. the same as there being no mapping for the specified key).
>
> The default implementations provided in Map are overridden in HashMap for performance purposes, in Hashtable for atomicity and performance purposes and in Collections for atomicity.
>
> Mike
>
More information about the core-libs-dev
mailing list