import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class testDataStore {
public static void main(String[] args) {
Map<String, Object> row1 = new HashMap<String, Object>();
row1.put("name","john");
row1.put("age",11);
Map<String, Object> row2 = new HashMap<String, Object>();
row2.put("name","john2");
row2.put("age",22);
Map<String, Object> row3 = new HashMap<String, Object>();
row3.put("name","john33");
row3.put("age",111);
List<Map<String,Object>> list = new ArrayList<>();
list.add(row1);
list.add(row2);
list.add(row3);
for (Map<String, Object> map : list) {//遍历数组
Set<String> keyset = map.keySet();//获得字典的key集合
for (String key : keyset) {//遍历key集合
System.out.print(key + ":" + map.get(key) + "\t");//打印key和value
}
System.out.println();//换行
}
}
}