Here you can find the source of toCsv(List
Parameter | Description |
---|---|
list | a parameter |
public static String toCsv(List<String> list)
//package com.java2s; //License from project: Apache License import java.util.Iterator; import java.util.List; public class Main { /**//from www. j a v a2 s .co m * Convert the list of strings to a comma separated string * * @param list */ public static String toCsv(List<String> list) { String res = ""; Iterator<String> it = list.iterator(); while (it.hasNext()) { res += it.next(); if (it.hasNext()) res += ", "; } return res; } }