今天用到了,发现不会,随手谷歌之,整理如下。
//Map是接口,刚才在那new Map,汗颜 Map<Character,Integer> mm = new HashMap(); //Iterator也是接口 Iterator<Character> iter = mm.keySet().iterator(); while(iter.hasNext()) { char key = iter.next(); //do sth }
//Map是接口,刚才在那new Map,汗颜
Map<Character,Integer> mm = new HashMap();
//Iterator也是接口
Iterator<Character> iter = mm.keySet().iterator();
while(iter.hasNext()) {
char key = iter.next();
//do sth
}