Here you can find the source of join(List> texts, String separator)
public static String join(List<?> texts, String separator)
//package com.java2s; //License from project: BSD License import java.util.List; public class Main { public static String join(List<?> texts, String separator) { StringBuilder result = new StringBuilder(); for (Object text : texts) { result.append(text);/* w ww. j a v a 2 s. com*/ result.append(separator); } return result.toString(); } public static String join(String separator, Object... texts) { StringBuilder result = new StringBuilder(); boolean isFirst = true; for (Object text : texts) { if (isFirst) { result.append(separator); isFirst = false; } result.append(text); } return result.toString(); } }