Here you can find the source of join(List
public static String join(List<String> strings, String separator)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.List; public class Main { public static String join(List<String> strings, String separator) { StringBuilder sb = new StringBuilder(); for (Iterator<String> i = strings.iterator(); i.hasNext();) { sb.append(i.next()).append(i.hasNext() ? separator : ""); }/* ww w .jav a 2 s . c om*/ return sb.toString(); } }