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
------------- Commit messages: - [PATCH] Avoid redundant HashMap.containsKey call in EnvHelp.mapToHashtable Changes: https://git.openjdk.java.net/jdk/pull/9031/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=9031&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8287924 Stats: 5 lines in 1 file changed: 0 ins; 2 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/9031.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/9031/head:pull/9031 PR: https://git.openjdk.java.net/jdk/pull/9031