首页上一页 1 下一页尾页 1 条记录 1/1页
Map<String,String> map = new HashMap();
Emp emp1 = new Emp("231","张三");
Emp emp2 = new Emp("422","李四");
Emp emp3 = new Emp("83","王五");
Emp emp4 = new Emp("321","傻吧");
Emp emp5 = new Emp("543","无语");
map.put(emp1.get_id(), emp1.get_name());
map.put(emp2.get_id(), emp2.get_name());
map.put(emp3.get_id(), emp3.get_name());
map.put(emp4.get_id(), emp4.get_name());
map.put(emp5.get_id(), emp5.get_name());
Set<String> set = map.keySet();
Iterator it1 = set.iterator();
System.out.println("输出HashMap的集合,无序:");
while(it1.hasNext()){
String id1 = (String)it1.next();
String name1 = (String)map.get(id1);
System.out.println(id1+" "+name1);
}