Withdrawn: 8305538: Avoid redundant HashMap.containsKey call in ModuleDescriptor.Builder
duke
duke at openjdk.org
Tue Jul 18 01:20:18 UTC 2023
On Mon, 3 Apr 2023 08:08:45 GMT, Andrey Turbanov <aturbanov at 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
More information about the core-libs-dev
mailing list