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"?

No, I'm not endorsing the APIs provided, at least for now:-) there is room to debate what would be
the best choice(APIs) to support the "joint", if we decided to add one.

Sherman

Rémi Forax wrote:
Hi all,
bug 5015163 is a RFE that advocate to add a method join (like in Python)
to String/StringBuilder/StringBuffer.

Here is the corresponding webrev (using the new infrastucture :)
http://cr.openjdk.java.net/~forax/5015163/webrev.00/
The patch is against tl repository.

Who want to review it ?

For the record, i have previously proposed this fix using the jdk-collaboration forum more than one year ago but because i am lazy i haven't take the time to post it here.

cheers,
Rémi Forax



Reply via email to