Hi,
Quick question. Why do people put null checks backwards:
if ( null != this.inputSource ) {
IMHO it is harder to read than
if ( this.inputSource != null ) {
and means exactly the same thing.
Yep.
I think this is a throwback from the days of C, where swapping the conditions was a handy way to avoid =/== bugs like:
if ( this.inputSource = null ) {
But in Java, the compiler catches this error:
Found 1 semantic error compiling "Test.java":
10. if (inputSource = null) { <----------------> *** Error: The type of this expression, "Source", is not boolean.
I see.
So is there any other reason for this? Can I do a massive grep for 'null !=' and change these?
No, I think that is the major reason.