title: retrieve values of rows (from Postgresql) in a list in java
body: <p>I Used a HashMap for handling my ResultSet queried from PostgreSql using the code suggested by <a href="https://stackoverflow.com/questions/7507121/efficient-way-to-handle-resultset-in-java">RHT</a></p>
  
  <pre><code>public List resultSetToArrayList(ResultSet rs) throws SQLException{
      ResultSetMetaData md = rs.getMetaData();
      int columns = md.getColumnCount();
      ArrayList list = new ArrayList(50);
  
      while (rs.next()){
          HashMap row = new HashMap(columns);
          for(int i=1; i&lt;=columns; ++i){           
              row.put(md.getColumnName(i), rs.getObject(i));
          }
          list.add(row);
      }
  
      return list;
  }
  </code></pre>
  
  <p>I did it beacuse I wanted to shuffle this collection afterwards.</p>
  
  <p>now each row is like that:</p>
  
  <pre><code>  {owner=22172613@N07, count=2}
  </code></pre>
  
  <p>I do not know how I can do a for/each loop that I retrieve each owner id and corresponding number !!</p>