Question: 4. (a) Suppose a List list1 has elements A, B, C, and D. What is returned by: 1. list1.iterator ()next(); 2. list1.listIterator ()next(); 3. list1.listiterator

4. (a) Suppose a List list1 has elements "A", "B", "C", and "D". What is returned by: 1. list1.iterator ()next(); 2. list1.listIterator ()next(); 3. list1.listiterator (2) next(); 4. list1.listiterator (4) previous () ; (b) Say what is deleted (or what happens) to the above operations when followed by remove(). 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: list1.listIterator(2).next( () ; list1.listIterator(2).remove( ); list1.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
Get step-by-step solutions from verified subject matter experts
