Interface PriorityQueue

  • All Known Implementing Classes:
    BinaryHeap, SynchronizedPriorityQueue

    @Deprecated(since="2021-04-30")
    public interface PriorityQueue
    Deprecated.
    Replaced by the Buffer interface and implementations in buffer subpackage. Due to be removed in v4.0.
    Defines a collection for priority queues, which can insert, peek and pop.

    This interface is now replaced by the Buffer interface.

    Since:
    Commons Collections 1.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void clear()
      Deprecated.
      Clear all elements from queue.
      void insert​(java.lang.Object element)
      Deprecated.
      Insert an element into queue.
      boolean isEmpty()
      Deprecated.
      Test if queue is empty.
      java.lang.Object peek()
      Deprecated.
      Return element on top of heap but don't remove it.
      java.lang.Object pop()
      Deprecated.
      Return element on top of heap and remove it.
    • Method Detail

      • clear

        void clear()
        Deprecated.
        Clear all elements from queue.
      • isEmpty

        boolean isEmpty()
        Deprecated.
        Test if queue is empty.
        Returns:
        true if queue is empty else false.
      • insert

        void insert​(java.lang.Object element)
        Deprecated.
        Insert an element into queue.
        Parameters:
        element - the element to be inserted
        Throws:
        java.lang.ClassCastException - if the specified element's type prevents it from being compared to other items in the queue to determine its relative priority.
      • peek

        java.lang.Object peek()
        Deprecated.
        Return element on top of heap but don't remove it.
        Returns:
        the element at top of heap
        Throws:
        java.util.NoSuchElementException - if isEmpty() == true
      • pop

        java.lang.Object pop()
        Deprecated.
        Return element on top of heap and remove it.
        Returns:
        the element at top of heap
        Throws:
        java.util.NoSuchElementException - if isEmpty() == true