Here you can find the source of join(CharSequence separator, Collection> col)
public static StringBuilder join(CharSequence separator, Collection<?> col)
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import java.util.Collection; import java.util.Iterator; public class Main { public static StringBuilder join(CharSequence separator, Collection<?> col) { final StringBuilder result = new StringBuilder(); if (col != null) { for (Iterator<?> it = col.iterator(); it.hasNext();) { result.append(it.next()); if (it.hasNext()) { result.append(separator); }// www. j a va 2 s . c om } } return result; } }