title: How to convert the ResultSet object into ArrayList
body: <pre><code>List patternList=new ArrayList&lt;String&gt;();
  ResultSet rs=stat.executeQuery("select file_pattern from Pattern_table");
  while(rs.next()){
      sourcePattern=rs.getString(1);
      patternList.add(sourcePattern);
  }
  </code></pre>
  
  <p>Here I'm going through each record and add to a <code>list</code>. It's taking too much time to traverse through the <code>ResultSet</code> and adding the records in a <code>list</code>.</p>
  
  <p>Is there another way to add all the records of <code>ResultSet</code> in <code>list</code> at once?</p>
  
  <p>Or any alternate approach I could follow to achieve better performance?</p>