foreach遍历时不可以 对遍历的集合做 add和remove操作
可以使用 迭代器 进行操作
Iterator<String> it = a.iterator();
while (it.hasNext()) {
String temp = it.next();
if ("1".equals(temp)) {
it.remove();
}
}
foreach遍历时不可以 对遍历的集合做 add和remove操作
可以使用 迭代器 进行操作
Iterator<String> it = a.iterator();
while (it.hasNext()) {
String temp = it.next();
if ("1".equals(temp)) {
it.remove();
}
}