package com.lanxi.demo1_1_1; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry; public class Test {
public static void main(String[] args) {
Map map=new HashMap();
map.put(123, "张三");
map.put(456, "李四");
map.put(789, "王五");
System.out.println("keySet:"+map.keySet());
Iterator it=map.entrySet().iterator();
while(it.hasNext()){
Entry en=(Entry)it.next();
System.out.println("entrySet:"+en.getKey());
}
}
}
结果显示