Florian Lindauer <[EMAIL PROTECTED]> writes:

> I was not so aware that String-concatenation is so expensive,
> i.e. that it is implicitly done by converting to StringBuffer(?).

String in Java are immutable, so every time you concatentate two
Strings, you have *three* String object in memory at the peak.  A
StringBuffer is roughly analogous to a dynamically resizable C char*
buffer, much more efficient than immutable Strings.

String concatentation in non-loop, non-branching situations (i.e. s +
"foo") is generally implicitly converted into StringBuffer calls by
a Java compiler.

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to