Here you can find the source of toCommaString(Collection
public static final String toCommaString(Collection<String> c)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static final String toCommaString(Collection<String> c) { String commaStr = ""; for (String str : c) { commaStr = commaStr + str + ","; }/*from w w w . j a v a 2 s. c om*/ commaStr = commaStr.substring(0, commaStr.length() - 1); return commaStr; } public static final String toCommaString(String[] c) { String commaStr = ""; for (int i = 0; i < c.length; i++) { commaStr = commaStr + c[i] + ","; } commaStr = commaStr.substring(0, commaStr.length() - 1); return commaStr; } }