//循环一次,删除当前数据
for (int i = 0; i < list.size(); i++) {
Integer value = list.get(i);
if (value == 1 || value == 3 || value == 6) {
list.remove(i);
i--;
System.out.println(value);
}
}
//删除指定数据
for (int i = list.size() - 1; i >= 0; i--) {
Integer value = list.get(i);
if (value == 1 || value == 3 || value == 6) {
list.remove(i);
System.out.println(value);
}
}
参考自:https://blog.csdn.net/u012977315/article/details/80608724