Here you can find the source of join(Collection
public static String join(Collection<String> strings, String sep)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static String join(Collection<String> strings, String sep) { StringBuilder buf = new StringBuilder(); for (String str : strings) { buf.append(sep).append(str); }//from w ww.j ava2s . c o m return buf.substring(sep.length()); } }