Question: 1. (a) Suppose a List list1 has elements A, B, C, and D. What is returned by: 1. list1.iterator () .next(); 2. list1.listIterator 3.
1. (a) Suppose a List list1 has elements "A", "B", "C", and "D". What is returned by: 1. list1.iterator () .next(); 2. list1.listIterator 3. list1.listIterator 4. list1.listIterator (4).previous(); () .next(); (2) .next(); (b) Say what is deleted (or what happens) if next/previous is followed by remove in all of the above operations. Explain (answer each part separately. That is - assume the list is back intact after you answer part 1, and you start with a fresh copy of a 4-item list for part 2). (c) If we had the following sequence of commands: list 1.listIterator (2).next(); list1.listIterator (2).remove(); list 1.listIterator (4).previous(); what would be returned? What would the list look like following these operations?
Step by Step Solution
There are 3 Steps involved in it
Lets go through each part of your question a list1iteratornext This will return the first element of ... View full answer
Get step-by-step solutions from verified subject matter experts
