Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • 1
    Might be worth noting that the speed advantage does not materialize if you call StringBuffer.toString a single time, as the caller did a copy then. There could be a small benefit, only in the rare case of multiple invocations without changes. This String constructor provides more advantages for factories directly working on a correctly sized char[] buffer without reusing it afterwards, say String.concat(String), String.replace(char,char), Integer.toString(int), etc. Commented Sep 19, 2017 at 9:41