hello I am trying to write a class to implement a doubly linked list using a dummy header node but I am confused because I dont know if i have to create a separate node object call header node separated from the node creation for the linked list also this dummy header node is suppose to be invisible in other words the user is not suppose to know that there is a dummy header node this is what I am suppose to have
public class DoublyLinkedList<T> {
public class ListEmptyException extends Exception
{
public ListEmptyException(String message){
super(message);
}
}
public class NotInListException extends exception{
public NotInListException(String message){
super(message);
}
}
private static class Node<T>
{
private T data;
private Node<T> next;
private Node<T> prev;
}
private Node ( T d){} // I have problems in the creation of the node and dummy header node I know I need data
//like this
data = d;
next= null;
previous = null;
// but i dont know if this is correct
private Node (T d , Node<T> pref, Node<T> nref{
// also I have this constructor to create a node with previous and next references
}
}
private Node <T> head;
private Node <T> current;
private int size;
public DoublyLinkedList(){}// null constructor
public DoublyLinkedList(DoublyLinkedList<T> l){} // copy constructor of a linkedlist