/// <summary> /// Add an item to the priority queue. /// </summary> /// <param name="item"> /// Accepts null as an item /// </param> public IPriorityQueueItem <T> Add(T item) { var handle = new PriorityQueueItem <T>(item); // Add to last element of array, then percolate up _heap.Add(handle); handle.Index = _heap.Count - 1; PercolateUp(_heap.Count - 1); return(handle); }
protected bool Equals(PriorityQueueItem <T> other) { return(EqualityComparer <T> .Default.Equals(Item, other.Item)); }