Here you can find the source of writeFile(String file, List
public static void writeFile(String file, List<String> data) throws IOException
//package com.java2s; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.List; public class Main { public static void writeFile(String file, List<String> data) throws IOException { BufferedWriter out = new BufferedWriter(new FileWriter(file)); for (String line : data) { out.write(line);// w ww . j a v a 2s .c o m out.newLine(); } out.close(); } }