Join String list elements with a delimiter in one step

java

Solution

Java 8...

String joined = String.join("+", list);

Documentation: http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#join-java.lang.CharSequence-java.lang.Iterable-

Problem

Is there a function like join that returns List's data as a string of all the elements, joined by delimiter provided? ``` List<String> join; .... String join = list.join('+"); // join == "Elem 1+Elem 2"; ``` or one must use an iterator to manually glue the elements?

Original source

Related problems