Here you can find the source of join(String joiner, Collection
public static String join(String joiner, Collection<String> strings)
//package com.java2s; //License from project: LGPL import java.util.Collection; public class Main { public static String join(String joiner, Collection<String> strings) { if (strings == null) return null; StringBuffer buffer = new StringBuffer(); for (String string : strings) { if (buffer.length() > 0) { buffer.append(joiner);//from w ww. j a va 2 s.c o m } buffer.append(string); } return buffer.toString(); } }