CS205

Lists Code Tracing

Trace through List operations to predict the outcome.

Question 1 of 6Score: 0 pts
ArrayList Operations

What does the ArrayList contain after these operations? ArrayList<Integer> list = new ArrayList<>(); list.add(0, 10); list.add(1, 20); list.add(0, 5); list.add(2, 15);

ArrayList<Integer> list = new ArrayList<>();
list.add(0, 10);  // [10]
list.add(1, 20);  // [10, 20]
list.add(0, 5);   // [5, 10, 20]
list.add(2, 15);  // [5, 10, 15, 20]