About 193,000 results
Open links in new tab
  1. PriorityQueue (Java Platform SE 8 ) - Oracle Help Center

    An unbounded priority queue based on a priority heap. The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction …

  2. PriorityQueue in Java - GeeksforGeeks

    Oct 25, 2025 · A PriorityQueue in Java is a queue where elements are ordered based on their priority, rather than the order of insertion. By default, it uses natural ordering (min-heap), but a …

  3. Guide to Java PriorityQueue - Baeldung

    Jan 8, 2024 · In this short tutorial, we’ll talk about the Java implementation of the Priority Queue. First, we‘ll see the standard usage and present some examples by ordering the queue in …

  4. PriorityQueue (Java SE 21 & JDK 21) - Oracle

    An unbounded priority queue based on a priority heap. The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction …

  5. list - Java PriorityQueue with fixed size - Stack Overflow

    So I just started to ask myself if there is a way to have a priority queue with a fixed size in Java. I should behave like this: Is the item better than one of the allready stored?

  6. Difference between PriorityQueue and Queue Implementation in Java

    Jan 18, 2024 · Being an interface, the queue needs a concrete class for the declaration, and the most popular classes in Java are the LinkedList and PriorityQueue. These classes' …

  7. Implement PriorityQueue through Comparator in Java

    Aug 5, 2022 · In a priority queue, an element with high priority is served before an element with low priority. For this, it uses a comparison function which imposes a total ordering of the …

  8. java - how to set priority in priority queue - Stack Overflow

    May 26, 2016 · Now if you began to take values from the queue using poll(), you would get the values in lexicographical order, i.e. the natural order of String. If you want a queue that returns …

  9. How to Iterate over the Elements of a PriorityQueue in Java?

    Aug 6, 2025 · In this article, we will learn how to iterate over the elements of a PriorityQueue in Java. Example. To iterate over the elements of a PriorityQueue in Java, we can create an …

  10. Priority Queue Java Tutorial, Examples, Implementation & Use …

    Aug 3, 2025 · Whether you’re new to Java or just want a clean, no-nonsense guide, this step-by-step tutorial will take you from zero to confident coder with plenty of practical java priority …