Code example for PriorityQueue

Methods: add, poll, size

0
		 
		readNext(); 
	} 
	 
	void readNext() { 
		if (pqueue.size() == 0) {
			next = null;
			current = null;
			return; 
		} 
		// get the iterator with smallest entry 
		current = pqueue.poll();
		 
		next = current.data;
		 
		// if the iterator has more items remaining, retreive 
		// the next one and put the entry back in the pqueue 
		if (current.iterator.hasNext()) {
			current.data = current.iterator.next();
			pqueue.add(current);
		} 
	} 
 
	@Override 
	public boolean hasNext() {