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

Mike Duigou mike.duigou at oracle.com
Wed Dec 11 00:27:27 UTC 2013


I have added tests and documentation for the other methods.

http://cr.openjdk.java.net/~mduigou/JDK-8029795/1/webrev/

The documentation for some of the methods is ambiguous about how many access events are generated. For LRU cache is OK but other cases (counting based eviction) may care about the total number of accesses.

Mike

On Dec 10 2013, at 01:52 , Paul Sandoz <paul.sandoz at oracle.com> wrote:

> 
> 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 core-libs-dev mailing list