title: Put resultset values into Collection object then add to ArrayList
body: <p>I was processing my <code>resultset</code> to get the details. I need to return an <code>ArrayList</code>, so how can I put the key,values from the <code>resultset</code> to any of the collection objects and then put the same to an <code>ArrayList</code>?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>public List&lt;Bike&gt; addBikes() throws ClassNotFoundException, SQLException{
          List&lt;Bike&gt; bikeList = new ArrayList&lt;Bike&gt;();
  
          Class.forName("com.mysql.jdbc.Driver");
          Connection con  = null;
          Statement  stm = null;
          ResultSet rs = null;
          con=DriverManager.getConnection("jdbc:mysql://localhost:3306/spring_hibernate","root","root"); ;
          stm=con.createStatement(); 
          String qry="Select * from bike"; 
          rs=stm.executeQuery(qry);
          while(rs.next())
          {           
              /* I need to put   
               * rs.getString("name"),rs.getString("model")
               * etc into any of the suitable collection objects 
               * and then need to add those to the ArrayList - bikeList
               * 
               */
  
          }
          return bikeList;
  
      }
  </code></pre>