On Thu, 29 May 2025 22:21:12 GMT, Phil Race <p...@openjdk.org> wrote:

>it is one succinct line

But it's not one line - it's 2 lines
https://github.com/openjdk/jdk/blob/08b1fa4cb39e56497052e3ee13e679c8734cf7c5/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java#L174-L175

>there is nothing wrong with it

When I see `.containsKey` + `.get` instead of single `.get` - I always 
question: is this map can contain `null` values?
(Because it's the only reason why I can choose to have separate `.containsKey` 
call). So, it's always makes _reading_ code require a bit more brain activity, 
than it should be.
When we use `.get` + null check - it's more _obvious_ that we expect only 
non-null values.

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

PR Comment: https://git.openjdk.org/jdk/pull/24907#issuecomment-2987027909

Reply via email to