tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stubenrauch,Andreas" <me...@erv.de>
Subject RE: the Faster?
Date Fri, 01 Dec 2000 08:52:07 GMT
When you just take this code-snipplet into account probaly the first one is
faster (no
explicit Object creation) but it is more important what you do afterwards
with thekeySearch.
If you append more to the String afterwards the second should be prefered.
By the way this is an Java Topic and seems slightly off topic...

Regards,
Andreas

> -----Original Message-----
> From: Charles Sabourdin [mailto:zouylll@yahoo.com]
> Sent: Friday, December 01, 2000 2:42 AM
> To: tomcat-user@jakarta.apache.org
> Subject: the Faster?
> 
> 
>  Hi I was wondering what code would be faster between
> :
> 
> <%
> String thekeySearche = "";
> if(request.getParameter("thekeySearche")!=null){
>   thekeySearche = request.getParameter("title");
> }%>
> and 
> <%
> StringBuffer thekeySearche = new StringBuffer("");
> if(request.getParameter("thekeySearche")!=null){
> thekeySearche.append(request.getParameter("title"));
> }%>
> 
> if i only use thekeySearche  
> in statement like that :
>  if thekeySearche.equals("toto"){..} 
> or 
>  if thekeySearche.toString().equals("toto"){..}
> 
> ;)
>  
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
> 

Mime
View raw message