Implement a generic doubly linked list implementation called DoubleRefBasedList that implements the generic Listlnterface presented in dais chapter. In addition, create an iterator called DListlterator for the DoubleRefBasedList class. To make the implementation of DListlterator more efficient, you need to have access to the underlying doubly linked list in DoubleRefBasedList. The easiest way to accomplish diis is to move the iterator class inside the list class. This inner class is then a member of the DoubleRefBasedList class and will have access to all of the members of that class. So The DoubleRefBasedList class with an inner DListlterator class will be structured as follows:
public class DoubleRefBasedList
private DNode
// Assume Dnode has been defined as a node class with both
// a next and previous reference. It is used to implement
// the doubly linked list.
// Class members for Listlnterface implementation appear here.
// Inner class DListlterator
private class DListlterator
implements java.util.ListIterator
private DNode
// Class members for Listlterator implementation appear here.
// This inner class has access to members of the outer class.
} // end DListlterator
public java.util.ListIterator
return new DListlterator();
} // end listlterator
} // end DoubleRefBasedList
The cursor declaration is shown to demonstrate how members of the outer class can be accessed from the inner class. When a call is made to the DoubleRef BasedList method listlterator, the cursor will be initialized to reference the first node in the list.
Also write a test class diat tests that the operations for both the DoubleRef BasedList class and the DListlterator class are working properly.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.