On Mon, 3 Apr 2023 08:08:45 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`

This pull request has been closed without being integrated.

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

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

Reply via email to