RFR: 8305538: Avoid redundant HashMap.containsKey call in ModuleDescriptor.Builder
Andrey Turbanov
aturbanov at openjdk.org
Tue Apr 4 12:35:19 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.
-------------
Commit messages:
- [PATCH] Avoid redundant HashMap.containsKey call in ModuleDescriptor
Changes: https://git.openjdk.org/jdk/pull/13288/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13288&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8305538
Stats: 9 lines in 1 file changed: 0 ins; 2 del; 7 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