Here you can find the source of join(Collection> s)
public static String join(Collection<?> s)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Iterator; public class Main { /**//www. j a v a2s . c o m * Concatenate a Collection of Strings using the given delimiter. */ public static String join(Collection<?> s) { if (s == null) return ""; StringBuilder buffer = new StringBuilder(); Iterator<?> iter = s.iterator(); while (iter.hasNext()) { Object item = iter.next(); if (item != null) { buffer.append(item); if (iter.hasNext()) { buffer.append(", "); } } } return buffer.toString(); } }