Here you can find the source of join(Collection c)
public static String join(Collection c)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static String join(Collection c) { return join(c, ", "); }// w ww . ja v a2 s. co m public static String join(Collection c, String delim) { StringBuffer sBuffer = new StringBuffer(); boolean isFirst = true; for (Iterator itr = c.iterator(); itr.hasNext();) { if (!isFirst) sBuffer.append(delim); sBuffer.append(itr.next()); isFirst = false; } return sBuffer.toString(); } }