RFR: 8305785: Avoid redundant HashMap.containsKey call in java.util.regex
Andrey Turbanov
aturbanov at openjdk.org
Sun Apr 9 20:11:11 UTC 2023
`Pattern.namedGroups` and `Matcher.namedGroups` contains only non-null values. It means instead of separate `containsKey`+`get` calls, we can use single `HashMap.get` call and then compare result with null.
Result code is a bit simpler and faster.
-------------
Commit messages:
- 8305785: Avoid redundant HashMap.containsKey call in java.util.regex
- [PATCH] Avoid redundant HashMap.containsKey call in java.util.regex{Matcher, Pattern}
Changes: https://git.openjdk.org/jdk/pull/13303/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13303&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8305785
Stats: 10 lines in 2 files changed: 3 ins; 0 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/13303.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13303/head:pull/13303
PR: https://git.openjdk.org/jdk/pull/13303
More information about the core-libs-dev
mailing list