Java CSV from getCSVFromList(List myList)

Here you can find the source of getCSVFromList(List myList)

Description

Create a comma seperated value (CSV) string form the passed in list

License

Open Source License

Parameter

Parameter Description
myList the list

Return

String the coma seperated values string made from the passed in list

Declaration

public static String getCSVFromList(List<String> myList) 

Method Source Code


//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;
    }
}

Related

  1. formatAsCsv(List stringList)
  2. formatCsvRecord(List csvRecord, char csvSeparator)
  3. getArrayListFromCSV(String csvString)
  4. getAsCsv(List tags)
  5. getCSV(List l)
  6. getCSVFromList(List myList)
  7. getCSVList(String csvList)
  8. getCSVList(String csvList)
  9. getCSVString(List items)