Here you can find the source of join(List
public static String join(List<String> elements)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(List<String> elements) { if (elements.isEmpty()) return "[]"; StringBuilder ret = new StringBuilder(); for (String element : elements) ret.append(", ").append(element); return "[" + ret.substring(2) + "]"; }/*from w ww .j a v a 2 s . c o m*/ }