Here you can find the source of listToInString(List list)
public static String listToInString(List list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String listToInString(List list) { if (list == null || list.size() == 0) return null; StringBuffer buf = new StringBuffer(); for (int i = 0; i < list.size(); i++) { Object obj = list.get(i); if (obj != null && obj.toString().length() != 0) { if (i != 0) buf.append(", "); buf.append("'" + obj.toString() + "'"); }/*from w w w . j av a2 s . c o m*/ } return buf.toString(); } }