merge


Description:

public StringJoiner merge (StringJoiner other)

Merges the contents of another StringJoiner into this one. The other joiner's elements are added without its prefix and suffix, using its delimiter to join them as a single element.

Example:

    var j1 = new StringJoiner (", ", "[", "]");
j1.add ("a");
var j2 = new StringJoiner ("-");
j2.add ("b");
j2.add ("c");
j1.merge (j2);
assert (j1.toString () == "[a, b-c]");

Parameters:

other

the StringJoiner to merge from.

Returns:

this StringJoiner for chaining.