Here you can find the source of join(String delimiter, Collection
public static String join(String delimiter, Collection<String> stringCollection)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static String join(String delimiter, Collection<String> stringCollection) { StringBuilder sb = new StringBuilder(stringCollection.size() * (16 + delimiter.length())); for (String str : stringCollection) { sb.append(str).append(delimiter); }/* ww w. j a va 2 s .co m*/ return sb.toString(); } }