public static void writeFile(final File destination,final List<String> contents) throws IOException {
  final BufferedWriter bw=new BufferedWriter(new FileWriter(destination));
  try {
    for (    String line : contents) {
      bw.write(line);
      bw.newLine();
    }
    bw.flush();
  }
  finally {
    bw.close();
  }
}

public static void writeFile ( final File destination , final List < String > contents ) throws IOException { final BufferedWriter bw = new BufferedWriter ( new FileWriter ( destination ) ) ; try { for ( String line : contents ) { bw . write ( line ) ; bw . newLine ( ) ; } bw . flush ( ) ; } finally { bw . close ( ) ; } }
write the strings to the file , one per line .
