Here you can find the source of join(Iterable
public static String join(Iterable<String> strings, String separator)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { public static String join(Iterable<String> strings, String separator) { StringBuilder builder = new StringBuilder(); if (strings != null) { Iterator<String> iter = strings.iterator(); while (iter.hasNext()) { String part = iter.next(); builder.append(part);/* w w w . ja v a2s . c o m*/ if (iter.hasNext()) { builder.append(separator); } } } return builder.toString(); } }