Пример #1
0
  @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());
  }
Пример #2
0
 public LinkedList(E head) {
   this.head = head;
   this.tail = EmptyLinkedList.getEmptyLinkedList();
 }
Пример #3
0
 public LinkedList() {
   this.head = null;
   this.tail = EmptyLinkedList.getEmptyLinkedList();
 }