First, I found this thread because I was looking for confirmation of why IntelliJ IDEA suggested this change. I don’t think I found what I was looking for, but I suspect (though I can’t yet give a good example) that it may have something to do with the potential for programming errors related to the order of operations (==
is lower precedence than ?:
).
Also, I know this is kinda off topic, but for this particular case, this might be a good workaround:
if (nullableCollection.orEmpty().isEmpty()) { ... }