`

遍历Map时高效的遍历方法

    博客分类:
  • java
 
阅读更多

Same function:

 

Normal:

for(String tmp:userThird.keySet()){

                    thirdInfo.add(userThird.get(tmp).getType());

}

Better:

for (Map.Entry<String, UserLogin> e : userThird.entrySet()) {

                    thirdInfo.add(e.getValue().getType());

}

6
4
分享到:
评论
2 楼 HarborChung 2015-11-02  
1 楼 下一个大师Up 2015-10-31  
for (UserLogin e : userThird.values()) {
      thirdInfo.add(e.getType());
}

相关推荐

Global site tag (gtag.js) - Google Analytics