Here you can find the source of iterableToString(Iterable
public static <E> String iterableToString(Iterable<E> itrbl)
//package com.java2s; // Licensed under the Modified BSD Licence; see COPYING for details. public class Main { public static <E> String iterableToString(Iterable<E> itrbl) { StringBuffer buff = new StringBuffer(); buff.append("[ "); boolean first = true; for (E elem : itrbl) { if (!first) { buff.append(", "); }//from w ww.j a va 2 s.com first = false; buff.append(elem); } buff.append(" ]"); return buff.toString(); } /** Returns <code>"null"</code> if the argument <code>o</code> is null, and <code>o.toString()</code> otherwise. */ public static String toString(Object o) { if (o == null) return "null"; return o.toString(); } }