예제 #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();
 }