On Wed, 22 Jun 2022 21:29:50 GMT, Andrey Turbanov <[email protected]> wrote:
>> Instead of separate ConcurrentHashMap.get call, we can use result of
>> previous putIfAbsent call.
>
> 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/temporal/WeekFields.java line 331:
> 329: String key = firstDayOfWeek.toString() + minimalDaysInFirstWeek;
> 330: WeekFields rules = CACHE.get(key);
> 331: if (rules == null) {
Perhaps you don't even need this `if` block and the preceding `CACHE.get(key)`
and maybe it can be replaced with:
return CACHE.computeIfAbsent(key, ignore -> new WeekFields(firstDayOfWeek,
minimalDaysInFirstWeek));
-------------
PR: https://git.openjdk.org/jdk/pull/9208