Here you can find the source of join(String seprator, Iterable
public static <V> String join(String seprator, Iterable<V> coll)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; public class Main { public static <V> String join(String seprator, Object... arr) { return join(seprator, asList(arr)); }/*w ww . j a v a2 s .c o m*/ public static <V> String join(String seprator, Iterable<V> coll) { return join("", seprator, coll); } public static <V> String join(String prefix, String seprator, Iterable<V> coll) { return join(prefix, false, seprator, coll); } public static <V> String join(String prefix, boolean bQuote, String seprator, Iterable<V> coll) { StringBuffer sb = new StringBuffer(prefix); for (Iterator<V> iterator = coll.iterator(); iterator.hasNext();) { V v = iterator.next(); if (bQuote) sb.append("'"); sb.append(v.toString()); if (bQuote) sb.append("'"); if (iterator.hasNext()) sb.append(seprator); } return sb.toString(); } public static <T> List<T> asList(T... objs) { return Arrays.asList(objs); } public static <T> List<T> asList(Collection<T> coll) { return new ArrayList<T>(coll); } }