src/Writer.java
/**
     * writes a list of strings into a file
     */
writes a list of strings into a file
writes a list of strings into a file
public void writeStringsToFile(List<String> stringsToWrite, String filePath, boolean append) {
        File file = Paths.get(filePath).toFile();
        FileWriter w;
        BufferedWriter bw;
        try {
            w = new FileWriter(file, append);
            bw = new BufferedWriter(w);
            Iterator<String> temp = stringsToWrite.iterator();
            while (temp.hasNext()) {
                String m = temp.next();
                bw.write(m + "\n");
            }
            bw.flush();
            bw.close();
        } catch (IOException e) {
            JOptionPane.showMessageDialog(null, "No File to Save",
                    "Error", JOptionPane.ERROR_MESSAGE);   
        } 
    }
public void writeStringsToFile ( List < String > stringsToWrite , String filePath , boolean append ) { File file = Paths . get ( filePath ) . toFile ( ) ; FileWriter w ; BufferedWriter bw ; try { w = new FileWriter ( file , append ) ; bw = new BufferedWriter ( w ) ; Iterator < String > temp = stringsToWrite . iterator ( ) ; while ( temp . hasNext ( ) ) { String m = temp . next ( ) ; bw . write ( m + "\n" ) ; } bw . flush ( ) ; bw . close ( ) ; } catch ( IOException e ) { JOptionPane . showMessageDialog ( null , "No File to Save" , "Error" , JOptionPane . ERROR_MESSAGE ) ; } }
writes a list of strings into a file
writes a list of strings into a file