On Fri, 24 Jun 2022 07:22:05 GMT, Jaikiran Pai <[email protected]> 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/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));
But it will generate garbage: non-static lambda.
-------------
PR: https://git.openjdk.org/jdk/pull/9208