@Override public boolean isEmpty() { return this.delegate.isEmpty(); }
@Override public E peek() { if (isEmpty()) return null; else return peek(0); }
/** * Retrieves and removes the head of this queue, or <tt>null</tt> if this * queue is empty. * * @return the head of this queue, or <tt>null</tt> if this queue is empty. */ @Override public E poll() { E minValue; if (isEmpty()) return null; else { this.modCount++; minValue = data[0]; if (classicalRemove) { data[0] = data[heapSize - 1]; costs[0] = costs[heapSize - 1]; indices[this.getIndex(data[0])] = 0; indices[this.getIndex(minValue)] = -1; heapSize--; if (heapSize > 0) siftDown(0); } else { siftDownUp(0); indices[this.getIndex(minValue)] = -1; } return minValue; } }