<i18n dev> RFR: 8288723: Avoid redundant ConcurrentHashMap.get call in java.time [v2]

Andrey Turbanov aturbanov at openjdk.org
Mon Jul 4 20:25:46 UTC 2022


On Sun, 3 Jul 2022 19:47:16 GMT, Attila Szegedi <attila at openjdk.org> wrote:

>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8288723: Avoid redundant ConcurrentHashMap.get call in java.time
>>   use computeIfAbsent where lambda could be short and static
>
> src/java.base/share/classes/java/time/ZoneOffset.java line 435:
> 
>> 433:                     result = prev;
>> 434:                 }
>> 435:                 ID_CACHE.putIfAbsent(result.getId(), result);
> 
> Feel free to ignore this one, but you could still have this be a `computeIfAbsent` and put the ID_CACHE.putIfAbsent part in the lambda. Yeah, there'll be more work done inside of `computeIfAbsent` but I think it's an acceptable tradeoff for a more comprehensible code.

Implemented

-------------

PR: https://git.openjdk.org/jdk/pull/9208


More information about the i18n-dev mailing list