1
JavaIntermediate#puzzle#oop
Modifying a List while iterating with a for-each loop (which uses an Iterator internally) throws ConcurrentModificationException, since ArrayList's iterator is fail-fast and detects the structural modification.
List<Integer> list = new ArrayList<>(List.of(1, 2));
for (Integer i : list) {
if (i == 1) list.remove(i); // throws ConcurrentModificationException
}