Here you can find the source of toCsvRow(ArrayList
public static String toCsvRow(ArrayList<String> csvRow)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; public class Main { public static String toCsvRow(ArrayList<String> csvRow) { StringBuilder csvStringBuilder = new StringBuilder(); makeCsvRow(csvRow, csvStringBuilder); return csvStringBuilder.toString(); }/* w w w . ja v a 2s . c om*/ private static void makeCsvRow(ArrayList<String> row, StringBuilder csvStringBuilder) { String fieldDelim = ""; for (Object fieldObj : row.toArray()) { String field = fieldObj.toString(); field = field.replaceAll("\"", "\"\""); csvStringBuilder.append(fieldDelim).append("\"").append(field).append("\""); fieldDelim = ","; } } }