Here you can find the source of listToString(List list)
public static String listToString(List list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String listToString(List list) { StringBuilder sb = new StringBuilder(); if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { if (i < list.size() - 1) { sb.append(list.get(i) + ","); } else { sb.append(list.get(i)); }//from w w w. j a v a2 s .c o m } } return sb.toString(); } }