遍历Map时高效的遍历方法

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());

}

你可能感兴趣的:(遍历Map时高效的遍历方法)