Here you can find the source of join(String separator, Collection c)
public static String join(String separator, Collection c)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { /**//from w w w . j a va 2s. com * Returns a string formed by the concatenation of string versions of the * elements in a collection, separated by a given separator. */ public static String join(String separator, Collection c) { StringBuffer buffer = new StringBuffer(); Iterator it = c.iterator(); if (it.hasNext()) buffer.append(it.next()); while (it.hasNext()) buffer.append(separator + it.next()); return buffer.toString(); } }