RFR: 8305538: Avoid redundant HashMap.containsKey call in ModuleDescriptor.Builder [v2]

Andrey Turbanov aturbanov at openjdk.org
Tue Apr 4 20:50:00 UTC 2023


> `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.

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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13288/files
  - new: https://git.openjdk.org/jdk/pull/13288/files/06afe446..d6a6f365

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13288&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13288&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/13288.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13288/head:pull/13288

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


More information about the core-libs-dev mailing list