Here you can find the source of listToCommaSeparatedString(List
public static String listToCommaSeparatedString(List<String> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String listToCommaSeparatedString(List<String> list) { if (list == null) { return null; }//from www .j a v a 2 s . c om StringBuffer result = new StringBuffer(); for (int i = 0; i < list.size(); i++) { result.append(list.get(i) + (i == list.size() - 1 ? "" : ", ")); } return result.toString(); } }