Fix for 5015163, and my first webrev

Xueming Shen Xueming.Shen at Sun.COM
Fri Feb 6 22:59:22 UTC 2009


Rémi Forax wrote:
> Xueming Shen a écrit :
>> public String join(Object first, Object... elements) {
>>     if (elements.length==0)
>>         return String.valueOf(first);
>>     return new StringBuilder().join(this, first, elements).toString();
>> }
>>
>> It does not look right to simply return String.valueOf(first); when 
>> elements size is 0, where is "this"?
> "this" is the delimiter.
>
> ",".join("hello", "world") => "hello,world"
>
> Thus it doesn't use "this" if there is only one argument.
oops, did not pay attention to the "deimiter part:-)



More information about the core-libs-dev mailing list