RFR: 8029795 : LinkedHashMap.getOrDefault() doesn't update access order. (was Why doesn't new Map methods generate entry accesses on LinkedHashMap?)

Paul Sandoz paul.sandoz at oracle.com
Tue Dec 10 01:52:58 PST 2013


On Dec 10, 2013, at 10:47 AM, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:

> 
> On Dec 10, 2013, at 5:37 AM, Mike Duigou <mike.duigou at oracle.com> wrote:
> 
>> Hello all;
>> 
>> I've posted a webrev for review which corrects the problem and adds appropriate tests.
>> 
>> http://cr.openjdk.java.net/~mduigou/JDK-8029795/0/webrev/
>> 
>> I also updated the documentation to mention that getOrDefault as well as the replace methods generate access events. 
>> 
> 
> Looking good. I don't have a strong opinion on sharing code for this method.
> 
> We should probably also test the other methods computeIfAbsent, computeIfPresent, compute and merge.
> 

Drat hit send too soon... i meant to also add that since the above methods can access entries, see code in HashMap for calls to afterNodeAccess, they need to be mentioned in the docs in addition to being tested.

Paul.



More information about the jdk8-dev mailing list