Class PriorityQueues

java.lang.Object
it.unimi.dsi.fastutil.PriorityQueues

public class PriorityQueues extends Object
A class providing static methods and objects that do useful things with priority queues.
See Also:
  • Field Details

  • Method Details

    • 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, 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.