java中遍历List中的map问题

List list = new ArrayList();
Map map = null;
while (rs.next()) {
map = new HashMap();
map.put("fromIP", rs.getString(""));
map.put("toIP", rs.getString(""));
map.put("netMode", rs.getString(""));
list.add(map);
}
简单循环取出hashmap后直接get就行了。

Map map = null;
String netMode=null;

for(int i=0;i<list.size();i++){
map=(HashMap)list.get(i);
netMode=(String)map.get("netMode");
System.out.println(netMode);

}
原文地址:https://www.cnblogs.com/zhujiabin/p/4277306.html