Here you can find the source of ListToString(List
public static String ListToString(List<String> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String ListToString(List<String> list) { if (list == null || list.isEmpty()) { return ""; }//from ww w .j a v a 2 s.co m String ns = ""; for (int i = 0; i < list.size(); i++) { String str = list.get(i); ns += str; if (i < list.size() - 1) { ns += ","; } } return ns; } }