首页 试题广场 > 试题详情
单选题

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);
提交并查看答案
下一题 上一题
Ke星伙伴们的回答/ 3个回答
  • SWYY 1楼

    ******
    发表时间:2017-08-17 08:34:17

  • 獨悴 2楼

    ******
    发表时间:2017-11-07 13:27:01

  • 子杰小同学 3楼

    ******
    发表时间:2018-02-09 10:04:57

关闭
关闭
QQ
交流群
邀请
好友
App
下载
意见
反馈
返回
顶部