public class IteratorMap {
public static void main(String[] args) {
Map map = new HashMap();
map.put("test", "test");
map.put("name", "dahai");
for(Iterator it = map.entrySet().iterator();it.hasNext();){
Map.Entry entry = (Map.Entry)it.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
}
}
遍历Map
最新推荐文章于 2023-08-08 09:03:57 发布