Here you can find the source of join(List
public static String join(List<String> list, String separator)
//package com.java2s; import java.util.List; public class Main { public static String join(List<String> list, String separator) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < list.size(); i++) { builder.append(list.get(i)); if (i < list.size() - 1) { builder.append(separator); }/*from ww w . j a v a2 s.co m*/ } return builder.toString(); } }