RFR: 8288329: Avoid redundant TreeMap.containsKey call in PolicyParser.read

Sean Mullan mullan at openjdk.java.net
Wed Jun 15 14:57:41 UTC 2022


On Sat, 30 Apr 2022 16:43:32 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> Instead of pair `TreeMap.containsKey`/`TreeMap.put` method calls, we can use single call `TreeMap.putIfAbsent` and check result for nullness.
> Only non-null values are put into `Map<String, DomainEntry> domainEntries`.
> https://github.com/openjdk/jdk/blob/53a0acee06eb32fba700967c9a34d37ea42f7a99/src/java.base/share/classes/sun/security/provider/PolicyParser.java#L205-L214

Looks good, but please add an appropriate `noreg` label to the bug.

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

Marked as reviewed by mullan (Reviewer).

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



More information about the security-dev mailing list