Member-only story
Hi everyone, welcome back. The priority queue is a data structure that follows a similar structure and functionality of a queue. Items in a priority queue contain a priority number, indicating their position in the queue. The items are then inserted into the queue based on their priority number.
Implemented Interfaces
The priority queue class implements various interfaces:
- java.io.serializable
- java.lang.iterable
- java.util.collection
- java.util.queue
Inherited Methods
The priority queue class inherits various methods from java.util.AbstractQueue, java.util.AbstractCollection, java.lang.Object, and java.util.Collection.
- java.util.AbstractQueue: addAll, element, remove
- java.util.AbstractCollection: containsAll, isEmpty, removeAll, retainAll, toString
- java.lang.Object: clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait
- java.util.Collection: containsAll, equals, hashCode, isEmpty, removeAll, retainAll
Priority Queue Methods
- add(E e): Adds an item into the priority queue.