Map map=new Map;
Student stu1=new Student(1,longer,male);
Student stu1=new Student(1,longer,male);
map.put("1",stu1);
map.put("2" stu2);
三种方法遍历map
1
Collection c=map.values();
for(Iterator lt=c.iterator();it.hasNext();)
{ studnet=it.next();
2
set c=map.keySet();
for(Iterator lt=c.iterator();it.hasNext();)
{ www.2cto.com
String id=(String)it.next();
map.get(id);
3
}
set> c=map.entrySet();
for(Iterator it=c.iterator;it.hasNext;){
Map.Entry entry=(Map.Entry)it.next();
entry.getKey();
entry.getValue();
}