Here you can find the source of getCommaSeparatedString(Collection extends Object> collection)
public static String getCommaSeparatedString(Collection<? extends Object> collection)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Iterator; public class Main { public static String getCommaSeparatedString(Collection<? extends Object> collection) { StringBuffer buffer = new StringBuffer(); Iterator<? extends Object> iterator = collection.iterator(); while (iterator.hasNext()) { Object obj = iterator.next(); buffer.append(obj.toString()); if (iterator.hasNext()) { buffer.append(", "); }//from w ww . j av a 2s .c o m } return buffer.toString(); } }