Here you can find the source of unionSeparator(List
public static String unionSeparator(List<String> elements, String separator)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String unionSeparator(List<String> elements, String separator) { final StringBuilder sb = new StringBuilder(); sb.append(elements.get(0));//from ww w . j a va2s .c om for (int i = 1; i < elements.size(); i++) { sb.append(separator); sb.append(elements.get(i)); } return sb.toString(); } }