Consider the following two lines of code
if (test ! = null)
and
if (null != test)
Is there is any difference in above two statements, performance wise? I have seen many people using the later and when questioned they say its a best practice with no solid reason.
No difference.
Second one is merely because C/C++ where programmers always did assignment instead of comparing.
E.g.
While java compiler will generate compilation error.
So I personally prefer first one because of readability, people tend to read from left to right, which read as
if test is not equal to nullinstead ofnull is not equal to test.