Here you can find the source of createCSV(Collection list)
public static String createCSV(Collection list)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may import java.util.Collection; public class Main { public static final String EMPTYSTR = ""; public static String createCSV(Collection list) { return createCSV(list, null); }/*from ww w .j ava 2 s .com*/ public static String createCSV(Collection list, String sep) { if (list == null) { return null; } if (sep == null) { sep = ", "; } StringBuilder sb = new StringBuilder(); for (Object addr : list) { sb.append(EMPTYSTR + addr); sb.append(sep); } String s = sb.toString(); if (s.endsWith(sep)) { s = s.substring(0, s.length() - sep.length()); } return s; } }