Java PriorityQueue

Java PriorityQueue is a class that implements the Java Queue interface and stores elements in a priority order. Elements are ordered according to their natural ordering or by a comparator provided at the time of instantiation. Introduced in Java 1997 with Java 1.2, PriorityQueue is used in algorithms that require ordering, such as Dijkstra's shortest path algorithm or heap-based data structures, and is part of Java's Java Collections Framework.

https://docs.oracle.com/javase/8/docs/api/java/util/PriorityQueue.html