/** * Retrieves, but does not remove, the greatest element of this queue, or * returns {@code null} if the queue is empty. */ public E peekLast() { return isEmpty() ? null : elementData(getMaxElementIndex()); }
/** * Removes and returns the greatest element of this queue. * * @throws NoSuchElementException if the queue is empty */ @CanIgnoreReturnValue public E removeLast() { if (isEmpty()) { throw new NoSuchElementException(); } return removeAndGet(getMaxElementIndex()); }
/** * Removes and returns the greatest element of this queue, or returns {@code * null} if the queue is empty. */ @CanIgnoreReturnValue public E pollLast() { return isEmpty() ? null : removeAndGet(getMaxElementIndex()); }