Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Iterator; public class Main { /** * Get comma separated string from collection * * @param strings * @return */ public static String getCommaSeparatedString(Collection<String> strings) { if (strings != null && !strings.isEmpty()) { Iterator<String> it = strings.iterator(); StringBuilder sb = new StringBuilder(it.next()); while (it.hasNext()) { sb.append("," + it.next()); } return sb.toString(); } else { return null; } } }