Here you can find the source of toCommaSeparatedString(List
public static String toCommaSeparatedString(List<String> list)
//package com.java2s; //License from project: Apache License import java.util.Iterator; import java.util.List; public class Main { public static String toCommaSeparatedString(List<String> list) { return toString(list, ", "); }//from w w w. j ava 2 s. c om public static String toString(List<String> list, String delimiter) { String argumentString = ""; Iterator<String> iterator2 = list.iterator(); for (int i = 0; iterator2.hasNext(); i++) { String argument = iterator2.next(); if (i > 0) argumentString += delimiter; argumentString += argument; } return argumentString; } }