Class PriorityQueue<T>
A PriorityQueue<T> holds elements on a priority heap, which orders the elements according to their natural order or according to the comparator specified at construction time. If the queue uses natural ordering, only elements that are comparable are permitted to be inserted into the queue.
The least element of the specified ordering is stored at the head of the queue and the greatest element is stored at the tail of the queue.
A PriorityQueue<T> is not synchronized.
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public class PriorityQueue<T> : ICollection<T> where T : class
Type Parameters
Name | Description |
---|---|
T | Type of elements |
Constructors
Name | Description |
---|---|
PriorityQueue() | Constructs a priority queue with an initial capacity of 11 and natural ordering. |
PriorityQueue(ICollection<T>) | Creates a PriorityQueue<T> containing the elements in the
specified collection. If the specified collection is an instance of
a |
PriorityQueue(IComparer<T>) | Constructs a priority queue with the specified capacity and comparer. |
PriorityQueue(PriorityQueue<T>) | Creates a PriorityQueue<T> containing the elements in the specified priority queue. This priority queue will be ordered according to the same ordering as the given priority queue. |
PriorityQueue(TreeSet<T>) | Creates a PriorityQueue<T> containing the elements in the specified TreeSet<T>. This priority queue will be ordered according to the same ordering as the given TreeSet<T>. The constructed priority queue has the initial capacity of 110% of the size of the sorted set. The priority queue will have the same comparator as the sorted set. |
PriorityQueue(SortedSet<T>) | Creates a PriorityQueue<T> containing the elements in the
specified The constructed priority queue has the initial capacity of 110% of the size of the sorted set. The priority queue will have the same comparator as the sorted set. |
PriorityQueue(Int32) | Constructs a priority queue with the specified capacity and natural ordering. |
PriorityQueue(Int32, IComparer<T>) | Creates a PriorityQueue<T> with the specified initial capacity that orders its elements according to the specified comparer. |
Properties
Name | Description |
---|---|
Comparer | Gets the |
Count | Gets the size of the priority queue. If the size of the queue is greater
than the |
IsReadOnly | Gets a value indicating whether the collection is read-only. |
Methods
Name | Description |
---|---|
Add(T) | Adds the specified object to the priority queue. |
AddAll(ICollection<T>) | |
Clear() | Removes all of the elements from this priority queue. |
Contains(T) | Returns |
CopyTo(T[], Int32) | Copies the elements of the priority queue to an Array, starting at a particular Array index. |
Element() | Retrieves, but does not remove, the head of this queue. This method differs from Peek() only in that it throws an exception if this queue is empty. This implementation returns the result of Peek() unless the queue is empty. |
GetEnumerator() | Gets the enumerator of the priority queue, which will not return elements in any specified ordering. |
Offer(T) | Inserts the specified element into this priority queue. |
Peek() | Gets but does not remove the head of the queue. |
Poll() | Gets and removes the head of the queue. |
Remove() | Retrieves and removes the head of this queue. This method differs from Poll() only in that it throws an exception if this queue is empty. This implementation returns the result of Poll() unless the queue is empty. |
Remove(T) | Removes the specified object from the priority queue. |