presto-main/src/main/java/io/prestosql/execution/resourcegroups/IndexedPriorityQueue.java/IndexedPriorityQueue/poll
class IndexedPriorityQueue:    @Override
    public E poll()
    {
        Iterator<Entry<E>> iterator = queue.iterator();
        if (!iterator.hasNext()) {
            return null;
        }
        Entry<E> entry = iterator.next();
        iterator.remove();
        checkState(index.remove(entry.getValue()) != null, "Failed to remove entry from index");
        return entry.getValue();
    }