Code example for PriorityQueue

Methods: size

0
    public DestructivePQIterator(PriorityQueue<T> pq) {
        this.pq = pq;
    } 
 
    public boolean hasNext() { 
        return pq.size() > 0;
    } 
 
    public T next() { 
        return pq.poll();
    } 
 
    public void remove() { 
        throw new UnsupportedOperationException();
    } 
}