Here you can find the source of getCSVFromList(List
Parameter | Description |
---|---|
myList | the list |
public static String getCSVFromList(List<String> myList)
//package com.java2s; import java.util.List; import java.util.Iterator; public class Main { /**//from w ww . j av a 2s.c om * Create a comma seperated value (CSV) string form the passed in list * @param myList the list * @return String the coma seperated values string made from the passed * in list */ public static String getCSVFromList(List<String> myList) { String output = null; Iterator<String> iter = myList.iterator(); while (iter.hasNext()) { String curVal = (String) iter.next(); if (null == output) { output = curVal; } else { output = output + "," + curVal; } } return output; } }