Here you can find the source of join(List
public static String join(List<String> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(List<String> list) { String rtn;/*w w w . j av a 2 s .c o m*/ if (list.isEmpty()) { rtn = ""; } else { StringBuilder sb = new StringBuilder(); for (String string : list) { sb.append(string).append(","); } rtn = sb.substring(0, sb.length() - 1); } return rtn; } }