title: Reading CSV file into an ArrayList<Student> java
body: <p>Student asking for help.</p>
  
  <p>I have a CSV file in the format (studentID,lastName,firstName,finalMark,finalGrade). I am trying to read this into a List of type Student / ArrayList of type Student - trying to add each line as a new Student. I have a Student class implementing Comparable for sorting the file. This Student class has these five (studentID,lastName,firstName,finalMark,finalGrade) as the Constructor.</p>
  
  <p>Can someone please demonstrate/show me, through code and/or explanation, how to read from the file, into the List using FileReader and BufferedReader or (second preference) Scanner.</p>
  
  <pre><code>public static ArrayList &lt;String&gt; readAllLinesFromFile(String path) throws IOException {
  
          // System.out.println("Cannot locate input file");
  
          ArrayList&lt;String&gt; studentList = new ArrayList&lt;String&gt;();
          FileReader fileReader = new FileReader("Question4unorderedList.csv");
          BufferedReader bufferedReader = new BufferedReader(fileReader);
          String line = null;
          while((line = bufferedReader.readLine())!=null) {
              studentList.add(line);
          }
          bufferedReader.close();
          return studentList;
      }
  </code></pre>
  
  <p>So I can create an ArrayList of type String. But how can I convert/parse/translate this ArrayList of Strings into a List or ArrayList of Student (my Student Class Constructor details are above).</p>
  
  <p>Thanks for your help.</p>