Java中向 List<Map<String, String>>中添加数据

Map map = new HashMap();
map.put("key1", "value1");
map.put("key2", "value2");
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
list.add(map);
for(int i = 0;i < list.size();i++)
{
    Map<String,Object> map = list.get(i);
    String authorStr = map.get("key1").toString();
    System.out.println("author" + " : " + authorStr);
}

猜你喜欢

转载自www.cnblogs.com/first-smal-white-blog/p/12652224.html
今日推荐