String. Join Java 8
public class main {
public static void main(String args[]) {
String[] wordsToJoin = new String[] {"Hi", "there", "<3"};
// first argument is the delimeter
String example1 = String.join(", ", wordsToJoin);
// can also do this instead
String example2 = String.join("^ ","Hi","there","<3");
System.out.println(example1; // Hi, there, <3
System.out.println(example2); // Hi^there^<3
}
}
Angry Antelope