RFR: String.join(), StringJoiner additions
Ulf Zibis
Ulf.Zibis at CoSoCo.de
Thu Apr 18 11:43:20 UTC 2013
Hi,
I don't think it's worth to add the braces at lines 2359..2360.
Please swap lines 2740 <-> 2739.
-Ulf
Am 18.04.2013 03:20, schrieb Roger Riggs:
> Hi,
>
> Can I suggest that the StringJoiner.toString() method explicitly append the suffix
> to the existing StringBuilder.
>
> 152 return (value != null ? value.toString() + suffix : emptyValue);
>
> Currently it will go to the trouble of creating a String from the builder and then
> transparently create another StringBuilder to do the concatenation.
>
> 152 return (value != null ? value.append(suffix).toString() : emptyValue);
>
> or something similar.
>
> The overhead of StringJoiner supporting prefix and suffix is lower than doing it separately
> in terms of object allocations and garbage and all places that would need write their
> own code to do the concatenation.
>
> Roger
>
>
> On 4/17/13 5:49 PM, Jim Gish wrote:
>> Here's an update: http://cr.openjdk.java.net/~jgish/Bugs-5015163-7172553/
>> <http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7172553/>
>>
>> Jim
More information about the core-libs-dev
mailing list