Here you can find the source of join(Iterable
public static <T> String join(Iterable<T> iterable)
//package com.java2s; public class Main { public static <T> String join(Iterable<T> iterable) { StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (T t : iterable) { if (!isFirst) { sb.append(","); isFirst = false;/*from www .j a va2s . co m*/ } sb.append(t.toString()); } return sb.toString(); } }