@Override public PriorityQueue<E> dequeue() { if (this.length() == 0) { head = null; return EmptyLinkedList.getEmptyLinkedList(); } head = (E) tail.head(); tail = tail.dequeue(); return new LinkedList<>(head, tail.copy()); }
public LinkedList(E head) { this.head = head; this.tail = EmptyLinkedList.getEmptyLinkedList(); }
public LinkedList() { this.head = null; this.tail = EmptyLinkedList.getEmptyLinkedList(); }