Here you can find the source of join(final Iterable
public static <T> String join(final Iterable<T> objs, final String delimiter)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { public static <T> String join(final Iterable<T> objs, final String delimiter) { Iterator<T> iter = objs.iterator(); if (!iter.hasNext()) { return ""; }//ww w . j a v a 2 s . c om StringBuffer buffer = new StringBuffer(String.valueOf(iter.next())); while (iter.hasNext()) { buffer.append(delimiter).append(String.valueOf(iter.next())); } return buffer.toString(); } }