Here you can find the source of join(Collection> collection, String separator)
public static String join(Collection<?> collection, String separator)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static String join(Collection<?> collection, String separator) { String s = ""; for (Object item : collection) { s += item.toString() + separator; }/*from w ww.j a v a 2 s .c om*/ return s.substring(0, s.length() - separator.length()); } }