Code example for PriorityQueue

Methods: add, poll

0
	public boolean hasNext() { 
		return (q.peek() != null);
	} 
 
	public E next() { 
		IPeekableIterator<E> i = q.poll();
		if(i == null) {
			throw new NoSuchElementException("Call hasNext!");
		} 
		E tmp = i.next();
		if(i.hasNext()) {
			q.add(i);
		} 
		return tmp;
	} 
	public void remove() { 
		throw new UnsupportedOperationException("No remove");
	} 
}