Class PriorityQueues


  • public class PriorityQueues
    extends java.lang.Object
    A class providing static methods and objects that do useful things with priority queues.
    See Also:
    PriorityQueue
    • Method Detail

      • emptyQueue

        public static <K> PriorityQueue<K> emptyQueue()
        Returns an empty queue (immutable). It is serializable and cloneable.

        This method provides a typesafe access to EMPTY_QUEUE.

        Type Parameters:
        K - the class of the objects in the queue.
        Returns:
        an empty queue (immutable).
      • synchronize

        public static <K> PriorityQueue<K> synchronize​(PriorityQueue<K> q)
        Returns a synchronized priority queue backed by the specified priority queue.
        Type Parameters:
        K - the class of the objects in the queue.
        Parameters:
        q - the priority queue to be wrapped in a synchronized priority queue.
        Returns:
        a synchronized view of the specified priority queue.
      • synchronize

        public static <K> PriorityQueue<K> synchronize​(PriorityQueue<K> q,
                                                       java.lang.Object sync)
        Returns a synchronized priority queue backed by the specified priority queue, using an assigned object to synchronize.
        Type Parameters:
        K - the class of the objects in the queue.
        Parameters:
        q - the priority queue to be wrapped in a synchronized priority queue.
        sync - an object that will be used to synchronize the access to the priority queue.
        Returns:
        a synchronized view of the specified priority queue.