List<map<String,Object>>

List<Map<String, Object>> list = sendService.getApproveMsgToMap();
//第一种
//遍历map
for (Map<String, Object> m : list)
{
for (String k : m.keySet())
{
System.out.println(k + " : " + m.get(k));
}

}


//第二种
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = list.get(i);
Set<String> set = map.keySet();//map.values();
Iterator<String> keyIterators = set.iterator();
while (keyIterators.hasNext()) {
String key = keyIterators.next();
Object object = map.get(key);
// Bean b = (Bean)value;

}
}

 

============================================

Map<String, Object> map

Iterator<String> iterator = map.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next().toUpperCase();//map应该是小写
Element element = root.addElement(key);
element.setText((String)map.get(key));
}

posted @ 2015-11-11 21:01  zshblog  阅读(473)  评论(0编辑  收藏  举报