Here you can find the source of ListtoCSV(List
static public String ListtoCSV(List<String> thelist, String sep)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may import java.util.List; public class Main { static public String ListtoCSV(List<String> thelist, String sep) { if (thelist.isEmpty()) return ""; StringBuilder sb = new StringBuilder(); for (Object obj : thelist) { sb.append(obj.toString());//from w w w . j av a 2 s. com sb.append(sep); } return sb.substring(0, sb.toString().length() - sep.length()); } }