Here you can find the source of toArray(Iterable itr)
public static String toArray(Iterable itr)
//package com.java2s; //License from project: CDDL license public class Main { public static String toArray(Iterable itr) { StringBuffer sb = new StringBuffer(32); sb.append('['); for (Object obj : itr) { if (obj instanceof String) { sb.append('\'').append(obj).append("',"); }/*from w w w . j a v a2 s . c o m*/ } if (sb.length() > 1) sb.setLength(sb.length() - 1); sb.append(']'); return sb.toString(); } }