- Type Parameters:
E
- Type of elements in Priority Queue
Priority queue used by the Heap sorter.
- Author:
- Richard van den Ham (r.vandenham@fontys.nl)
-
Method Summary
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
get
E get()Remove SMALLEST element of the queue and return it. The ordering is based on theComparator<E>
provided to the constructor. -
getComparator
Comparator<E> getComparator()Get the comparator used to compare elements.- Returns:
- comparator
-
iterator
Iterator to iterate over Priority queue. Hint to implementer: we expect the implementation to CONSUME the priority queue. This means that the hasNext() method checks if the priority queue is not empty and the next() method invokes the get() method. As a result, the iterator will return elements in sorted order and after using the iterator, the priority queue will be empty.
-