Question: After each commented section, explain what the data structure looks like at that point in the code. (2 points each, 8 points total). ArrayList numbers;

  1. After each commented section, explain what the data structure looks like at that point in the code. (2 points each, 8 points total).

    ArrayList numbers;

    numbers = new ArrayList<>();

    for(int i=90; i<=100; i++)

    numbers.add(i);

    //picture 1

    numbers.set(numbers.size()-1, 10);

    numbers.remove(new Integer(91));

    numbers.remove(0);

    //picture 2

    LinkedList aList;

    aList = new LinkedList<>();

    for(int i=10; i>=1; i--){

    aList.addFirst(i);

    }

    //picture 3

    aList.removeLast();

    aList.addFirst(100);

    aList.addFirst(aList.getLast());

    //picture 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!