I have the following code:
ResultSet rs = DB.doQuery("SELECT username,register_ip FROM users ORDER BY joined DESC LIMIT 10");
Map<String,String> botInfo = new HashMap<String, String>();
List<Map<String , String>> myMap = new ArrayList<Map<String,String>>();
int c = 0;
while(rs.next()) {
botInfo.put("username", rs.getString("username"));
botInfo.put("register_ip", rs.getString("register_ip"));
myMap.add(c, botInfo);
c++;
}
The idea is to have the output be like this.. and I'll use PHP as an example:
[0] => array('username' => 'someUsername', 'register_ip' => 'someIP');
And so on.. but, what I get is a list of 10 HashMaps that all contain the same username,register_ip value. What are my options?