Why did they name PriorityQueue
if you can\'t insertWithPriority? It seems very similar to a heap. Are there any differences? If no difference, the
Add() works like an insertWithPriority.
You can define priority for the type that you want using the constructor:
PriorityQueue(int, java.util.Comparator)
look under https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/PriorityQueue.html
The order the Comparator gives will represent the priority in the queue.