Re: String concatenation tweaks

2015-04-07 Thread Peter Levart
On 04/07/2015 11:10 PM, Louis Wasserman wrote: Could that actually be provided immutability-safely? I suppose an append-only, fixed-length builder would be potentially safe. I think the presented implementation *is* thread and immutability safe. It only allows mutations from the constructin

Re: String concatenation tweaks

2015-04-07 Thread Peter Levart
Hi Louis, This is nice. Amd could be even nicer. In case the estimated initial StringBuilder capacity is exactly the final String length, then constructing the String could skip the char[] copying step as the StringBuilder instance does not escape. But in order to be safe, this would have to

Re: String concatenation tweaks

2015-04-07 Thread Louis Wasserman
Could that actually be provided immutability-safely? I suppose an append-only, fixed-length builder would be potentially safe. Part of the trickiness there is with primitive parameters, where presizing and doing the actual append both require calculating the size of the primitive when converted t