why many programmers use integer literal on left handside of equality operator?
- by nash
Hi,
Many a times in blogs and books, i have seen conditions in if statements like this:
if(0 == a.size()){...}
or
if(-1 == str.indexOf(ch)){...}
Is there any performance advantage in using integer literals on left hand side in conditions or is it just a style that some programmers prefer?