飞鱼蓝空

导航

集合遍历

1.ArrayList遍历删除

Iterator<App> iter = arrayList.iterator();
while(iter.hasNext()){
  App app = iter.next();
  if(app.getScan()==-2){
    iter.remove();
  }
}

2.HashMap遍历取值(键+值)

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

}

 

posted on 2016-08-04 17:42  飞鱼蓝空  阅读(91)  评论(0编辑  收藏  举报