/** * Removes all of the elements from this queue */ public void clear() { while (!isEmpty()) { remove(); } }
/** * Remove and return the first object in the queue. * * @return Dequeued object. * * @exception EmptyCollectionException The queue is empty. */ public E remove() throws EmptyCollectionException { if (isEmpty()) throw new EmptyCollectionException(); return removeFirst(); }