[Advanced-java] Performances

Gorokhov, Mark V. Mark.Gorokhov at celera.com
Thu Jul 3 18:41:29 2003


"ss" is never null, while foo might be.

-mg

-----Original Message-----
From: Marco Ferretti [mailto:marco.ferretti@jrc.it] 
Sent: Thursday, July 03, 2003 9:58 AM
To: advanced-java@lists.xcf.berkeley.edu
Subject: [Advanced-java] Performances


I there guys, I wonder if someone can point me somewhere. I have always
coded boolean evaluation on strings like :

String foo = "123";

if(foo.equals("456") ){

    ...

}

probably because I code as I think (if the variable equals something
....).

I took a look at sun's code for jdk and always saw the above as 

String foo = "123";

if("ss".equals(foo) ){

    ...

}



So : is there some reason (eg. performance) why I should change the way
I always coded such things ?



TIA

    Marco
_______________________________________________
Advanced-java mailing list
Advanced-java@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/advanced-java