java中list remove元素如何避免ConcurrentModificationException
JDK
List<String> list = new ArrayList<>();
Iterator<String> iterator = list.iterator();
while (iterator.hasNext()) {
String string = iterator.next();
if (string.isEmpty()) {
// 移除
iterator.remove();
}
}
Loading...