// Textbook fragment 05.15 public E dequeue() throws EmptyQueueException { if (size == 0) throw new EmptyQueueException("Queue is empty."); E tmp = head.getElement(); head = head.getNext(); size--; if (size == 0) tail = null; // the queue is now empty return tmp; }