Java PriorityQueue:Next-Best Without Sorting the Whole List Use PriorityQueue when you need the next-best element in O(log n) — a heap, not a sorted list, and not a FIFO queue. Read More →