Add optimization for last priority in PrioritizedIterator