On Tue, 4 Apr 2023 20:50:00 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:

>> `Map.containsKey` call is sometimes unnecessary, when it's known that `Map` 
>> doesn't contain `null` values.
>> Instead of pair containsKey+put we can use putIfAbsent and compare result 
>> with null.
>> Result code is shorter and a bit faster.
>> Same approach is used with `HashSet<String> uses` in 
>> `java.lang.module.ModuleDescriptor.Builder#uses`. Instead of separate 
>> `contains`+`add` - we can just call `add` then check what it returns.
>> 
>> Testing: Linux x64 `java/lang`
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8305538: Avoid redundant HashMap.containsKey call in 
> ModuleDescriptor.Builder
>   
>   update java.lang.module.ModuleDescriptor.Builder.uses too

let's wait for review a bit more

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

PR Comment: https://git.openjdk.org/jdk/pull/13288#issuecomment-1557703281

Reply via email to