// 第一种:通过Map.keySet遍历key和value
System.out.println("通过Map.keySet遍历key和value:");
for (String key : map.keySet()) {
System.out.println("key= " + key + " and value= " + map.get(key));
}
//第二种
private static Map temp = new HashMap();
for(Iterator it = temp.entrySet().iterator(); it.hasNext(); ){
Map.Entry e = (Map.Entry)it.next();
System.out.println("key: " + e.getKey());
System.out.println("value: " + e.getValue());
}