开发者社区> 问答> 正文

java iterator怎样获取元素下标?

public static List delete() {

Iterator it = stuList.iterator();
while (it.hasNext()) {
Info stu = it.next();
System.out.println("请输入要删除的遍号");
//int rmv = sc.nextInt();
if (stu.toString().indexOf("这里怎么写") != -1) {
it.remove();
} 
}
return stuList; 
}

展开
收起
蛮大人123 2016-03-20 16:13:03 4719 0
1 条回答
写回答
取消 提交回答
  • 我说我不帅他们就打我,还说我虚伪

    跟迭代器无关吧,读出stu之后,查询它的id属性是否是要删除的编码.

    2019-07-17 19:09:47
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载