Here you can find the source of join(Collection
public static String join(Collection<String> c, String joinSymbol)
//package com.java2s; //License from project: LGPL import java.util.Collection; public class Main { public static String join(Collection<String> c, String joinSymbol) { StringBuffer sb = new StringBuffer(""); if (c != null) { for (String text : c) { sb.append(text).append(joinSymbol); }//from w ww.j a v a 2s . c o m int sblen = sb.length(); int symlen = joinSymbol.length(); if (sblen > symlen) { sb.delete(sblen - symlen, sblen); } } return sb.toString(); } }