1、iterator遍历:(注意要是用迭代器的remove方法,不能使用list的remove方法)
Iterator it = list.iterator();
while(it.hasNext()){
String x = it.next();
if(x.equals(“del”)){
it.remove();
}
}
最好使用Iterator遍历
1、iterator遍历:(注意要是用迭代器的remove方法,不能使用list的remove方法)
Iterator it = list.iterator();
while(it.hasNext()){
String x = it.next();
if(x.equals(“del”)){
it.remove();
}
}
最好使用Iterator遍历