StringJoiner in b88

Paul Sandoz paul.sandoz at
Fri May 17 02:10:14 PDT 2013

On May 17, 2013, at 9:32 AM, Joe Bowbeer <joe.bowbeer at> wrote:

> Previously, when StringJoiner was a stream destination, I could collect
> into one using the three-arg variant:
>  s.into(new StringJoiner(delimiter, prefix, suffix));
> For example:
>  elements.into(new StringJoiner(", ", "[", "]"));
> But I can't now because Collectors.toStringJoiner(delimiter) is the only
> option.
> What's the recommended workaround?
> Should Collectors.toStringJoiner(delimiter, prefix, suffix) be added?

The problem is, when executing in parallel, how to combine two such StringJoiner instances, since the prefix and suffix are only relevant to the final result and not the intermediate results.

We would need another methods e.g.:

  StringJoiner merge(StringJoiner that) {
    return add(that.value.substring(that.prefix.length()));

i.e. throw away the prefix characters of "that".


More information about the lambda-libs-spec-observers mailing list