Writing a method retainAll for Circular Doubly-Linked List:
I am working on an assignment creating a Circular Doubly LinkedList and am having serious trouble creating a method retainAll.Here’s the code, and my attempt.
Initialization:
public class CDoublyLinkedList {
private class Node {
private Object data; //Assume dataimplemented Comparable
private Node next, prev;
private Node(Object data, Nodepref, Node next)
{
this.data =data;
this.prev =pref;
this.next =next;
}
}
private Node head;
private int size;
public CDoublyLinkedList() {
this.head = new Node(null, null,null );
this.head.next = this.head;
this.head.prev=this.head;
this.size =
OR
OR