Here you can find the source of join(Collection
public static <T> String join(Collection<T> coll, String separator)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static <T> String join(Collection<T> coll, String separator) { if (coll == null) return null; StringBuilder sb = new StringBuilder(); boolean looped = false; for (T t : coll) { if (looped) sb.append(separator);/*from ww w . jav a 2s .c o m*/ sb.append(t.toString()); looped = true; } return sb.toString(); } }