(Implement a doubly linked list) The MyLinkedList class used inListing 24.5 is a one-way directional linked list that enablesone-way traversal of the list. Modify the Node class to add the newdata field name previous to refer to the previous node in the list,as follows
: public class Node {
E element;
Node next;
Node previous;
public Node(E e) {
element = e; } }
Implement a new class named TwoWayLinkedList that uses a doublylinked list to store elements. Define TwoWayLinkedList toimplements MyList. You need to implement all the methods defined inMyLinkedList as well as the methods listIterator() andlistIterator(int index). Both return an instance ofjava.util.ListIterator (see Figure 20.4). The former sets thecursor to the head of the list and the latter to the element at thespecified index..