过去 3 天我花时间让以下结构工作,但我无法弄清楚如何让结构工作
array
1 =>
array
0 =>
array
'id' => '1'
'name' => 'xyz'
1 =>
array
'id' => '12'
'name' => 'xyz1'
2 =>
array
'id' => '54'
'name' => 'xyz12'
20 =>
array
0 =>
array
'id' => '1'
'name' => 'xyz'
1 =>
array
'id' => '12'
'name' => 'xyz1'
2 =>
array
'id' => '54'
'name' => 'xyz12'
3 =>
array
'id' => '566'
'name' => 'xyz1234'
我尝试了以下事情,但我无法继续前进
Map<Integer, ArrayList<HashMap<String, Object>>> data = new HashMap<Integer, ArrayList<HashMap<String, Object>>>();
我有一个结果集,因为我有如下信息
id | name | element_id
______________________________________________________________
1 | xyz | 1
______________________________________________________________
1 | xyz | 3
______________________________________________________________
12 | xyz1 | 1
______________________________________________________________
54 | xyz11 | 1
______________________________________________________________
566 | xyz1234 | 3
______________________________________________________________
12 | xyz1 | 3
______________________________________________________________
54 | xyz11 | 3
______________________________________________________________
我的代码是
while (resultSET.next())
{
Map<String, Object> tag = new HashMap<String, Object>();
tag.put("name", resultSET.getString(3));
tag.put("id", resultSET.getInt(2));
tags.put(resultSET.getInt(1), tag);
}