java.lang.Object ArrayPriorityQueue<Element>
public class ArrayPriorityQueue<Element extends java.lang.Comparable<Element>>
ArrayPriorityQueue is an array implementation of Priority Queue.
Constructor Summary | |
---|---|
ArrayPriorityQueue()
|
Method Summary | |
---|---|
void |
clear()
Removes all elements from the priority queue. |
Element |
dequeue()
Retrieves and removes the head of this queue. |
void |
enqueue(Element element)
Adds the specified element to this priority queue. |
boolean |
isEmpty()
Indicates whether or not the queue is empty. |
java.util.Iterator<Element> |
iterator()
Return an iterator over the items in this queue. |
Element |
peek()
Retrieves, but does not remove, the head of this queue. |
int |
size()
Returns the number of elements currently in this queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayPriorityQueue()
Method Detail |
---|
public boolean isEmpty()
PriorityQueue
isEmpty
in interface PriorityQueue<Element extends java.lang.Comparable<Element>>
public int size()
PriorityQueue
size
in interface PriorityQueue<Element extends java.lang.Comparable<Element>>
public void clear()
PriorityQueue
clear
in interface PriorityQueue<Element extends java.lang.Comparable<Element>>
public void enqueue(Element element)
PriorityQueue
enqueue
in interface PriorityQueue<Element extends java.lang.Comparable<Element>>
element
- is an item to be enqueuedpublic Element peek()
PriorityQueue
peek
in interface PriorityQueue<Element extends java.lang.Comparable<Element>>
public Element dequeue()
PriorityQueue
dequeue
in interface PriorityQueue<Element extends java.lang.Comparable<Element>>
public java.util.Iterator<Element> iterator()
iterator
in interface java.lang.Iterable<Element extends java.lang.Comparable<Element>>