http://blog.csdn.net/sprita1/article/details/7899482(转)
public static void main(String[] args) {
Map map = new HashMap();
map.put("1", "value1");
map.put("2", "value2");
Iterator it = map.entrySet().iterator();
while(it.hasNext()){
Map.Entry entry = (Map.Entry) it.next();
Object key = entry.getKey();
Object val = entry.getValue();
System.out.println(key);
System.out.println(val);
Map map = new HashMap();
map.put("1", "value1");
map.put("2", "value2");
Iterator it = map.entrySet().iterator();
while(it.hasNext()){
Map.Entry entry = (Map.Entry) it.next();
Object key = entry.getKey();
Object val = entry.getValue();
System.out.println(key);
System.out.println(val);
}
}