Redigera

Dela via


PriorityQueue<TElement,TPriority>.Remove Method

Definition

Removes the first occurrence that equals the specified parameter.

public bool Remove (TElement element, out TElement removedElement, out TPriority priority, System.Collections.Generic.IEqualityComparer<TElement>? equalityComparer = default);
member this.Remove : 'Element * 'Element * 'Priority * System.Collections.Generic.IEqualityComparer<'Element> -> bool
Public Function Remove (element As TElement, ByRef removedElement As TElement, ByRef priority As TPriority, Optional equalityComparer As IEqualityComparer(Of TElement) = Nothing) As Boolean

Parameters

element
TElement

The element to try to remove.

removedElement
TElement

The actual element that got removed from the queue.

priority
TPriority

The priority value associated with the removed element.

equalityComparer
IEqualityComparer<TElement>

The equality comparer governing element equality.

Returns

true if matching entry was found and removed, false otherwise.

Remarks

The method performs a linear-time scan of every element in the heap, removing the first value found to match the element parameter.

In case of duplicate entries, what entry does get removed is non-deterministic and does not take priority into account.

If no equalityComparer is specified, Default will be used instead.

Applies to