I Used a HashMap for handling my ResultSet queried from PostgreSql using the code suggested by RHT
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<=columns; ++i){
row.put(md.getColumnName(i), rs.getObject(i));
}
list.add(row);
}
return list;
}
I did it beacuse I wanted to shuffle this collection afterwards.
now each row is like that:
{owner=22172613@N07, count=2}
I do not know how I can do a for/each loop that I retrieve each owner id and corresponding number !!