RFR: String.join(), StringJoiner additions
Jim Gish
jim.gish at oracle.com
Fri Apr 19 17:40:00 UTC 2013
Martin,
I've updated the toString() method as you suggested.
http://cr.openjdk.java.net/~jgish/Bugs-5015163-7172553/
<http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7172553/>
Thanks,
Jim
On 04/18/2013 05:02 PM, Martin Buchholz wrote:
>
>
>
> On Thu, Apr 18, 2013 at 10:34 AM, Jim Gish <jim.gish at oracle.com
> <mailto:jim.gish at oracle.com>> wrote:
>
> That was a nice idea, but you don't want to change the value when
> you do toString(). Otherwise, if you subsequently add a new
> element, you're hosed because you've already added on the suffix.
>
>
> You can cheaply save the current length, append the suffix, call
> toString, and reset the length back to the old value to avoid the
> overhead of String "+".
--
Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
Oracle Java Platform Group | Core Libraries Team
35 Network Drive
Burlington, MA 01803
jim.gish at oracle.com
More information about the core-libs-dev
mailing list