commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baltz, Kenneth" <Kba...@firstam.com>
Subject RE: StringBuffer pools and why not to use them
Date Tue, 18 Feb 2003 19:26:17 GMT
I also seem to recall that as of JDK 1.4,

	String a = b + c + d;

is converted by the compiler to: 

	String a = new StringBuffer().append(b).append(c).append(d);

Not as terrible as it seems at first blush and a lot more readable. 

Of course, no discussion of optimization should occur without considering
Knuth's statement, "Premature optimization is the root of all evil."  Make
sure you actually need these benefits before you spend too much time on
them, especially as optimized code is sometimes less readable.  

K.C.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message