title: Read from text file and store to collection
body: <p>I am thinking a way to store a bunch of data read from text file to a collection which is arraylist. After i read the file i have to idea how to store it. For example, data from text file:
  Problem Solving with C++:Walter Savitch:9780132773348:QA760-073:NON FICTION:2 
  Here is part my code:</p>
  
  <p><strong>Get from text file:</strong></p>
  
  <pre><code>public void actionPerformed(ActionEvent arg0) {
              JFileChooser chooser = new JFileChooser();
              FileNameExtensionFilter filter = new FileNameExtensionFilter(
                      "Text and Data Files", "txt", "dat");
              chooser.setFileFilter(filter);
              int returnVal = chooser.showOpenDialog(MainMenu.this);
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                  String filename = chooser.getSelectedFile()
                          .getAbsolutePath();
                  readBooks(filename);
              }
          }
  
  
  public void readBooks(String filename) {
      try {
          BufferedReader reader = new BufferedReader(new FileReader(filename));
          int i = 0;
          String line;
          line = reader.readLine();
          while (line != null &amp;&amp; !line.equals("")) {
              i++;
              processBook(line);
              line = reader.readLine();
          }
          System.out.println("" + i + " books read");
      } catch (Exception e) {
          System.err.println(e.getMessage());
          e.printStackTrace();
      }
  }
  
  public void processBook(String line) {
      int id = nextBookID;
      nextBookID++;
  
      String[] parts = line.split(":");
      String title = parts[0];
      String author = parts[1];
      String bookISBN = parts[2];
      String callNumber = parts[3];
      String type = parts[4];
      String noOfCopy = parts[5];     
  
      System.out.println("Creating book " + id);
  
      // TODO: add create book and add to collection(s)
  
  
  
  }
  </code></pre>