why many programmers use integer literal on left handside of equality operator?

Posted by nash on Stack Overflow See other posts from Stack Overflow or by nash
Published on 2010-06-02T05:53:39Z Indexed on 2010/06/02 6:03 UTC
Read the original article Hit count: 219

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about programming-languages