list是一个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.it.remove();
B.list.remove(obj);
C.list.remove(index);
D.list.remove(obj,index);