Member-only story

Java Programming Language: Priority Queue Class

Jesse L
2 min readSep 17, 2021

--

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.

--

--

Jesse L
Jesse L

Written by Jesse L

Hi, I'm a passionate technology enthusiast and lifelong learner. Beyond my technical pursuits, I'm also passionate about sharing my enthusiasm with others.

No responses yet