Here you can find the source of join(List
public static String join(List<String> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String join(List<String> list) { String str = ""; for (int i = 0; i < list.size(); i++) { if (i > 0) { str += ","; }// w w w .j a va 2 s . co m str += "'" + list.get(i) + "'"; } return str; } public static String join(List<String> list, String separator) { String str = ""; for (int i = 0; i < list.size(); i++) { if (i > 0) { str += separator; } str += list.get(i); } return str; } }