Loading... (original) (raw)
A DESCRIPTION OF THE REQUEST :
Please add an "append substring" method to StringBuilder, with semantics similar to the already existing "append sub-char-array", append(char[], int, int).
JUSTIFICATION :
With the recent change to String.substring where it copies the underlying char[] rather than reusing it, it is no longer "free" to append substrings to a StringBuilder.
Yes, perhaps the JIT eventually figures that out, but why make it do that work? And as a developer it's risky to rely on the JIT for such things - how can I be sure it will always do the right thing?