title: Populate List<Object> from ResultSet without creating new Object for each dataset
body: <p>I have been always using the following code to add Objects from a ResultSet into a List. However someone commented that it is not very efficient to create a new Object for every dataset in the ResultSet. Is there a better way? Or, is there a whole different way to add Object from a ResultSet to a List?</p>
  
  <pre><code>public static List&lt;Students&gt; selectFromDatabase(Connection conn, Statement stmt){
      List&lt;Students&gt; list = new ArrayList&lt;Students&gt;();
      String select = "SELECT * FROM students";
      ResultSet rs = null;
  
      try{
          stmt = conn.createStatement();
          rs = stmt.executeQuery(select);
  
          while(rs.next()){
              //you have to create a new OBJECT FOR EACH LOOP
              Students student = new Students();
              student.setStudentId(rs.getInt(1));
              student.setName(rs.getString(2));
              student.setGpa(rs.getInt(3));
              list.add(student);
          }               
      }catch(SQLException e){
          System.out.println(e.getMessage());
      }       
      return list;
  }
  </code></pre>