Here you can find the source of convertCollectionToCommaDelimitedString(Collection collection)
public static String convertCollectionToCommaDelimitedString(Collection collection)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static String convertCollectionToCommaDelimitedString(Collection collection) { StringBuffer sb = new StringBuffer(); if (collection != null) { Iterator iter = collection.iterator(); int count = 0; while (iter.hasNext()) { String item = (String) iter.next(); if (count != 0) { sb.append(", "); }/*from www . j a va 2 s . c o m*/ sb.append(item); count++; } } return sb.toString(); } }