Here you can find the source of join(List
public static String join(List<String> lst, int start, int end)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String join(List<String> lst, int start, int end) { return join(lst, start, end, " "); }/* ww w. ja v a 2 s. c o m*/ public static String join(List<String> lst, int start, int end, String delim) { String res = ""; if (start < 0) { start = 0; } if (end >= lst.size()) { end = lst.size() - 1; } if (start > end) { return res; } else { res = (String) lst.get(start); for (int i = start + 1; i <= end; i++) { res += delim + (String) lst.get(i); } return res; } } public static String join(List<String> lst, String delim) { String res = ""; if (lst.size() > 0) { res = lst.get(0); } for (int i = 1; i < lst.size(); i++) { res += delim + lst.get(i); } return res; } public static String join(List<String> lst) { return join(lst, " "); } }