Here you can find the source of join(String token, Collection strings)
public static String join(String token, Collection strings)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String join(String token, String[] strings) { StringBuffer sb = new StringBuffer(); for (int x = 0; x < (strings.length - 1); x++) { sb.append(strings[x]);/* ww w . j a v a 2s .c o m*/ sb.append(token); } sb.append(strings[strings.length - 1]); return (sb.toString()); } public static String join(String token, Collection strings) { StringBuffer sb = new StringBuffer(); for (Iterator iter = strings.iterator(); iter.hasNext();) { sb.append(iter.next()); if (iter.hasNext()) { sb.append(token); } } return (sb.toString()); } }