Here you can find the source of join(final List
public static String join(final List<String> strings, final String separator)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(final List<String> strings, final String separator) { if (strings == null) { return ""; }/*from ww w . j a v a 2 s. c o m*/ return join(strings.toArray(new String[strings.size()]), separator); } public static String join(final String[] strings, final String separator) { return join(strings, 0, strings.length, separator); } public static String join(final String[] strings, int startIndex, int endIndex, final String separator) { final StringBuilder result = new StringBuilder(); for (int i = startIndex; i < endIndex; i++) { if (i > startIndex) result.append(separator); result.append(strings[i]); } return result.toString(); } }