public static void retunKeyAndValue(Map<String,Object> map){
System.out.println("通过Map.entrySet遍历key和value");
for (Map.Entry<String, Object> entry : map.entrySet()) {
System.out.println("key = " + entry.getKey() + " and value = " + entry.getValue());
}
}
/**
* map 转换成list
*/
public static List returnList(Map map) {
List list = new ArrayList();
Iterator iter = map.entrySet().iterator(); //获得map的Iterator
while(iter.hasNext()) {
Entry entry = (Entry)iter.next();
list.add(entry.getValue());
}
return list;
}
原文:http://www.cnblogs.com/codekey/p/4643130.html