Pleezon
Pleezon
JCHJava Community | Help. Code. Learn.
Created by Pleezon on 11/6/2022 in #java-help
4 lines of mayhem
public static void main(String[] args)
{
List<Integer> list = new ArrayList<>();
List<Integer> subList = list.subList(0, 0);
list.addAll(subList);
list.addAll(subList);
}
public static void main(String[] args)
{
List<Integer> list = new ArrayList<>();
List<Integer> subList = list.subList(0, 0);
list.addAll(subList);
list.addAll(subList);
}
Throws a ConcurrentModificationException in the last line, and I have no clue why.
19 replies