On Mon, 7 Feb 2022 21:22:12 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Modified per suggestions on the PR
>
> src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java 
> line 5162:
> 
>> 5160: 
>> 5161:                 formatter = new 
>> DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(locale);
>> 5162:                 DateTimeFormatter old = 
>> FORMATTER_CACHE.putIfAbsent(key, formatter);
> 
> .computeIfAbsent(key, () -> {....}) might be a bit cleaner/clearer here and 
> avoid the race a few lines of code below. (a slight improvement in old code).

Good point. Changed to `computeIfAbsent()`.

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

PR: https://git.openjdk.java.net/jdk/pull/7340

Reply via email to