peter.levart at gmail.com
Sat Apr 22 09:40:24 UTC 2017
Seeing the following line in some JDK test that was up for review:
return cf.findModule(target).orElse(null) == null;
I immediately jumped to suggest it would look better if written as:
But then I leaned back and asked myself: "Would it really?"
The boolean negation in front of a chain of method calls tends to
visually disappear from the view when we finally reach the offending
method and might get missed when quickly browsing the code. In this
respect, ".orElse(null) == null" is actually better. But the best would
of course be something like that:
What do you think? Would this pull its weight?
More information about the core-libs-dev