code: public static void writeFile( List<String> lines, File file ) throws IOException {
          try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) {
              for( String line : lines ) {
                  bw.write(line);
                  bw.write("\n"); //$NON-NLS-1$
              }
          }
      }
docs: Write a list of lines to a file.
  
  @param lines the list of lines to write.
  @param file  the file to write to.
  
  @throws IOException