Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. private void saveToFile() {
  2.                 Collection<Film> filmCollection = database.values();
  3.                 for(Film film : filmCollection) {
  4.                         try {
  5.                                 FileWriter outFile = new FileWriter("c:/pmdb/database.txt");
  6.                                 PrintWriter out = new PrintWriter(outFile);
  7.                                 out.println(film.toString());
  8.                                 out.close();
  9.                         } catch (IOException e){
  10.                                 e.printStackTrace();
  11.                         }
  12.                 }
  13.         }