public boolean saveData(String filename) { boolean wasSaveSuccessful = false; BookReadNode bookReadNode = listHead; try { File file = new File(filename); PrintWriter printWriter = new PrintWriter(file); for (BookReadEntry bookReadEntry : bookReadNode.getBookReadEntryObj()) { System.out.println("SAVING BOOK: " + bookReadNode.getBookReadEntryObj().getBookObj().getBookTitle()); printWriter.println(bookReadNode.getBookReadEntryObj().toFileFormat()); } printWriter.flush(); printWriter.close(); wasSaveSuccessful = true; } catch (FileNotFoundException fileNotFoundException) { wasSaveSuccessful = false; } return wasSaveSuccessful; }