Feedback on the implementation of StringJoiner

Henry Jen henry.jen at oracle.com
Thu Dec 13 11:18:06 PST 2012


On 12/13/2012 01:37 AM, Remi Forax wrote:
> Hi Henry,
> if we don't change the implementation of StringJoiner now (see my mail 
> about my inability to test the stream pipeline),
> there are at least two things that can be changed in your current 
> implementation.
>

We don't change as I explained to you, save an intermediate allocate of
char[] and two copies for a list and copy of references is not necessary
better.

> All the static final String can be removed because the string are 
> interned so there is no need to store then in a static fields.
> Even if you think the code is more clear with that and you may be right, 
> it's not a standard practice, the only code that does that is 
> String.java (as far as I know).
> 
> You don't need the field 'somethingAdded' because you can test the 
> length of the StringBuilder (value).
> 

Agree.

Cheers,
Henry



More information about the lambda-dev mailing list