单项选择题
list是Java中的一个ArrayList对象,在以下代码的//todo delete处填入(),可在Iterator遍历的过程中正确并安全的删除list中保存的对象。Iterator it = list.iterator();int index = 0;while (it.hasNext()){Object obj = it.next();if (needDelete(obj)) { //needDelete返回boolean,决定是否要删除//todo delete}index ++;}
A.list.remove(obj)
B.list.remove(index)
C.list.remove(it.next())
D.it.remove()
A.iterator();int
B.hasNext()){Object
C.next();if
D.list.remove(obj)
B.list.remove(index)
C.list.remove(it.next())
D.it.remove()