[Advanced-java] Performances

Martin Cooper martin.cooper at tumbleweed.com
Thu Jul 3 18:51:33 2003


This is hardly an "advanced" Java question; you're mailing the wrong list.

I'll answer your question with a question: what would happen in your code if
foo was null?

--
Martin Cooper


> -----Original Message-----
> From: Marco Ferretti [mailto:marco.ferretti@jrc.it]
> Sent: Thursday, July 03, 2003 6: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
>