Here you can find the source of collectionToString(Collection> c)
public static String collectionToString(Collection<?> c)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.List; public class Main { public static String collectionToString(Collection<?> c) { return c.toString(); }/*from w w w.ja v a2s .c o m*/ public static String collectionToString(Collection<?> c, String delimeter) { StringBuilder result = new StringBuilder(c.toString().replaceAll(",", delimeter)); result.deleteCharAt(0); result.deleteCharAt(result.length() - 1); return result.toString(); } public static void collectionToString(List<String> cols, StringBuilder sql) { for (String col : cols) { sql.append(col + ","); } if (sql.length() > 1) { sql.deleteCharAt(sql.length() - 1); } } }