Comprehension

Report a typo

What will we see after running this code?

CopyOnWriteArrayList<Integer> onWriteArrayList = new CopyOnWriteArrayList<>();
onWriteArrayList.add(1);
onWriteArrayList.add(2);
onWriteArrayList.add(3);

Iterator<Integer> iterator = onWriteArrayList.iterator();

while (iterator.hasNext()) {
    System.out.print(iterator.next() + " ");
    iterator.remove();
}
Select one option from the list
___

Create a free account to access the full topic