Loading

LinkedHashMap遍历

第一种: 
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
效率高,以后一定要使用此种方式!
第二种:
Map map = new HashMap();
Iterator iter = map.keySet().iterator();
while (iter.hasNext()) {
Object key = iter.next();
Object val = map.get(key);
}
效率低,以后尽量少使用!

http://zhidao.baidu.com/link?url=uM1QmZoEq4pRI3bNSGrdzrKhl9eU3ZtYCJ2fgNkz0wRloeQD_qDEY9qsl0hwg2j3dYCl_wf_YML1HtPkEp5yI7fG85shhVK3sNsUToqq-tO
posted @ 2015-08-13 09:16  stono  阅读(19687)  评论(2编辑  收藏  举报