Map遍历
[html]
<span style="font-size:18px;">Map<string,student> map=new Map<string,student>;
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<studnet> c=map.values();
for(Iterator lt=c.iterator();it.hasNext();)
{ studnet=it.next();
}
2
set<string> c=map.keySet();
for(Iterator lt=c.iterator();it.hasNext();)
{ www.zzzyk.com
String id=(String)it.next();
map.get(id);
3
}
set<Map.entry<string,student>> c=map.entrySet();
for(Iterator it=c.iterator;it.hasNext;){
Map.Entry<string,studnet> entry=(Map.Entry<string,student>)it.next();
entry.getKey();
entry.getValue();
}</span>
补充:软件开发 , C++ ,