title: How to get all remaining rows from ResultSet java sql package
body: <p>I used to use com.datastax.driver.core.ResultSet. I could take all remaining rows and put it into an Array of my model class and then add it to List of Arrays. </p>
  
  <p>Below is my previous code with ResultSet from datastax package.</p>
  
  <pre><code>List&lt;ReportDescription[]&gt; result = new ArrayList&lt;&gt;();
  ReportDescription[] csvReportDescriptions;
  csvReportDescriptions = resultSet.all().stream()
                      .map(row -&gt; new ReportDescription(row.getObject("value"))).toArray(ReportDescription[]::new);
  result.add(csvReportDescriptions);
  </code></pre>
  
  <p>Nowadays I change database so now I need to swithch ResultSet to java.sql.ResultSet package. Is it any possibility to get all rows, create new instance of my models and put it into List of Arrays as I did it before?</p>
  
  <p><strong>I make it by my own like that</strong></p>
  
  <pre><code>try {
  ResultSet rS = dataSource.getConnection().createStatement().executeQuery(query.toString());
      while(rS.next()){
          descriptions.add(new ReportDescription(rS.getObject("VALUE")));
      }
      } catch (SQLException e) {
                  dataSource.logError("Can't execute statement :" + query.toString());
      }               
  
      csvReportDescriptions = descriptions.toArray(new ReportDescription[descriptions.size()]);
      result.add(csvReportDescriptions);
  </code></pre>