Folks, if we're going to make the change from String to StringBuffer for
things, may I please ask that it be kept in what I consider the more
readable form? What I mean is that instead of converting
log("text" + var + "more text" + anothervar);
into:
StringBuffer logBuffer = new StringBuffer("text");
logBuffer.append(var);
logBuffer.append("more text");
logBuffer.append(anothervar);
log(logBuffer.toString());
I would prefer to see:
log(new StringBuffer(128).append(text).append(var).append("more
text").append(anothervar).toString());
I prefer that style, as did the authors of the StringBuffer class.
However, more important than style is that although the new
StringBuffer(128) is arbitrarily chosen for the example, it is important to
provide a reasonable initial buffer size. If you use StringBuffer(), the
size defaults to 16. If you use StringBuffer(String), you only get 16 bytes
more than the length of the initial string. You will lose the performance
benefits you wanted from StringBuffer, because it will have to call
expandCapacity() multiple times.
YMMV, but this is my request/suggestion/proposal.
--- Noel
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>