Here you can find the source of commaSeparatedList(Collection c)
public static String commaSeparatedList(Collection c)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static String commaSeparatedList(Collection c) { StringBuffer text = new StringBuffer(); if (c == null) { return "(empty)"; }/*from w w w . ja v a2 s.com*/ Iterator i = c.iterator(); while (i.hasNext()) { Object o = i.next(); if (text.length() > 0) { text.append(", "); } text.append(o.toString()); } return text.toString(); } }