RFR: 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 8
stuart.marks at oracle.com
Wed May 2 06:39:22 UTC 2012
On 5/1/12 10:16 AM, Rémi Forax wrote:
> On 05/01/2012 05:50 PM, Jim Gish wrote:
>> Should I proceed with improvements to String.join() or wait, for example,
>> until the lambda array support is there?
> better to ask Brian Goetz :)
Hi guys, this came back around to me internally to Oracle since I've been
kicking around some similar ideas in the context of lambda, though nothing has
made it to the lambda repos yet.
Unfortunately, while I don't think there is a direct dependency of String.join
on any of the lambda stuff, we will probably want to coordinate the creation of
these APIs. We don't want to put stuff into the mainline now, and then pull it
out or retrofit it when the lambda stuff gets integrated later. So, strange as
it may seem, it may be better to work on this in the lambda forest.
It's not clear to me that we have to move the discussion over to lambda-dev
though. This is at least as much about libraries as it is about lambda.
(For those watching at home, the background regarding how this relates to
lambda is described in  with some discussion starting at . In a nutshell,
the "lambdafied" libraries approach we're taking is to use lambda expressions
to operate on streams of values. Right now streams look like Iterables but this
is going to change. We want to be able to join streams of stringy things as
well as arrays and collections.)
It's fun to think about how joining would work in a lambda/streamy kind of
or some such. There are a bunch of issues to consider here though, such as
special-casing of types in the input stream, e.g., append CharSequence directly
instead of calling toString(), treat int value as a Unicode code point, etc.
There are also issues about the result type: StringBuilder? String? Appendable?
As much as I like the lambda stuff, though, I don't think having stream-based
joining will supplant the need to have a good old-fashioned
String.join(",", ...bunch of strings...)
More information about the core-libs-dev