This enhancement proposal has a long history. The most recent attempt
to get some String.join() methods was by Joe Darcy back in 2009 (
http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-October/002967.html)
He started with the changes that Remi Forax had done 8 months prior to
that, which Remi had attempted a year before that!
I've taken the work that Remi and Joe did and am trying again.
There was a lot of discussion that was generated and that is why this
has died on the vine a number of times. I realize that the current
proposal may also generate discussion, but I think this had merit 4
years ago and still does. We won't satisfy everyone. It may not be
perfect (what is?!), but if we can look at it from the perspective that
something is better than nothing, then we ought to attempt a quick
review and get this in.
Having said that, I ask that you please take a look at the
http://cr.openjdk.java.net/~jgish/5015163/webrev/
<http://cr.openjdk.java.net/%7Ejgish/5015163/webrev/>
Just a few words, based on the previous discussion, to set some context.
* join() is (roughlty) intended to be the inverse of split()
* example: "Hi there".join("-", "Bill", "Joe", "Zoe") will yield "Hi
there-Bill-Joe-Zoe"
* in the original proposal the delimiter character was what you
started with, i.e.
o "-".join( "Hi there", "Bill", "Joe", "Zoe") yielded the
same result as above
o it seemed awkward to have the delimiter be the String instance
that the join was performed on. I agree and so have made the
first parameter of the join be the delimiter.
* there was a lot of discussion about the pros and cons of making
join() a static method vs an instance method. The point was made
then, and I concur, that given that split() is an instance method,
it only makes sense that join() be one too. Certainly there are
other perspectives on this and one could argue the merit of each and
every one of them, but in the interests of progress, I think the
the split()/join() similarity argument is the most compelling and
natural.
Thanks,
Jim Gish