RFR: 8287924: Avoid redundant HashMap.containsKey call in EnvHelp.mapToHashtable

Serguei Spitsyn sspitsyn at openjdk.java.net
Wed Jun 8 17:50:37 UTC 2022


On Sat, 4 Jun 2022 17:28:33 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> No need to separately perform HashMap.containsKey before HashMap.remove call. If key is present - it will be removed anyway. If it's not present, nothing will be deleted.
> https://github.com/openjdk/jdk/blob/a6fc485a22484b70daf170e981432c0856b9d93d/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java#L735-L741

Looks good.
Thanks,
Serguei

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

Marked as reviewed by sspitsyn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/9031


More information about the serviceability-dev mailing list