Java CSV from toCsv(List list)

Here you can find the source of toCsv(List list)

Description

Convert the list of strings to a comma separated string

License

Apache License

Parameter

Parameter Description
list a parameter

Declaration

public static String toCsv(List<String> list) 

Method Source Code

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

Related

  1. parseCSVList(String csv)
  2. parseCsvList(String csvList)
  3. sanitizeListForCsv(List strList)
  4. toCsv(final List list)
  5. toCsv(List list)
  6. toCsv(List strs)
  7. toCSV(List list)
  8. toCSV(Set list)
  9. toCSVLine(String[] strArray)