RFR: 8357687: Remove unnecessary Map.containsKey from GraphicsEnvironment implementations

Phil Race prr at openjdk.org
Thu May 29 22:23:53 UTC 2025


On Sun, 27 Apr 2025 21:04:34 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> `devices` contains only non-null values. It means instead of separate `containsKey` call we can just call `HashMap.get` and then compare result with `null`.

Myself, I like the existing code because
- it is one succinct line
- it is more readable (subjective)
- there is nothing wrong with it
- performance is not a concern for this code, and any improvement will be miniscule

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

PR Review: https://git.openjdk.org/jdk/pull/24907#pullrequestreview-2879741097


More information about the client-libs-dev mailing list