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

Andrey Turbanov aturbanov at openjdk.org
Mon Jun 20 08:07:02 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://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/53a0acee06eb32fba700967c9a34d37ea42f7a99/src/java.base/share/classes/sun/security/provider/PolicyParser.java*L205-L214__;Iw!!ACWV5N9M2RV99hQ!MYjrZeeC3SvB-PXMjtJ1MKbKVlyU-a4FU-6T-YpF2xuNMD8V4t-D72Yerko2VutSI2IROskm_vBLAiURjVc02YrJaw$ 

This pull request has now been integrated.

Changeset: 7acdcc10
Author:    Andrey Turbanov <aturbanov at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/7acdcc1034fb9529ee7b617889d38b0e557a20ec
Stats:     4 lines in 1 file changed: 0 ins; 2 del; 2 mod

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

Reviewed-by: mullan

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

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



More information about the security-dev mailing list