Here you can find the source of concatenateWithComma(Collection
public static String concatenateWithComma(Collection<String> collection)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static String concatenateWithComma(Collection<String> collection) { StringBuilder sb = new StringBuilder(); boolean first = true; for (String ss : collection) { if (!first) { sb.append(", "); } else { first = false;/*from ww w .j a v a 2 s . c o m*/ } sb.append(ss); } return sb.toString(); } }