我在List内有一堆ArrayList对象。
我需要将所有ArrayList对象写入带有管道“ |”的csv文件中分隔符。
String filePath = "C:\\Users\\test2.csv";
FileWriter outputfile = new FileWriter(file);
CSVWriter writer = new CSVWriter(outputfile, '|',
CSVWriter.NO_QUOTE_CHARACTER,
CSVWriter.DEFAULT_ESCAPE_CHARACTER,
CSVWriter.DEFAULT_LINE_END);
List<ArrayList<String>> databaseColListToFetch=databaseColList;
for(int i=0;i<databaseColList.size();i++){
ArrayList<String> al=databaseColList.get(i);
//Need code here which will write all the ArrayList Objects into csv file
//writer.writeAll(al);//not sure about csv writer will write ArrayList<String>
}
writer.close();