Table of Contents

Interface IReadOnlyDictionaryHeap<TKey, TValue>

Namespace
LfrlAnvil.Collections
Assembly
LfrlAnvil.Collections.dll

Represents a generic read-only heap data structure with the ability to identify entries by keys.

public interface IReadOnlyDictionaryHeap<TKey, TValue> : IReadOnlyHeap<TValue>, IReadOnlyList<TValue>, IReadOnlyCollection<TValue>, IEnumerable<TValue>, IEnumerable

Type Parameters

TKey

Key type.

TValue

Value type.

Inherited Members
Extension Methods

Properties

KeyComparer

Key equality comparer.

IEqualityComparer<TKey> KeyComparer { get; }

Property Value

IEqualityComparer<TKey>

Methods

ContainsKey(TKey)

Checks whether or not an entry with the specified key exists in this heap.

[Pure]
bool ContainsKey(TKey key)

Parameters

key TKey

Key to check.

Returns

bool

true when entry with the specified key exists, otherwise false.

GetIndex(TKey)

Returns the 0-based position of an entry associated with the specified key.

[Pure]
int GetIndex(TKey key)

Parameters

key TKey

Key to get an index for.

Returns

int

0-based position of an entry associated with the specified key.

Exceptions

KeyNotFoundException

When key does not exist in this heap.

GetKey(int)

Returns the key associated with an entry located at the specified index.

[Pure]
TKey GetKey(int index)

Parameters

index int

0-based position.

Returns

TKey

Key associated with an entry located at the specified index.

Exceptions

IndexOutOfRangeException

When index is not in [0, Count) range.

GetValue(TKey)

Returns an entry associated with the specified key.

[Pure]
TValue GetValue(TKey key)

Parameters

key TKey

Key to get an entry for.

Returns

TValue

Entry associated with the specified key.

Exceptions

KeyNotFoundException

When key does not exist in this heap.

TryGetValue(TKey, out TValue)

Attempts to return an entry associated with the specified key if it exists.

bool TryGetValue(TKey key, out TValue result)

Parameters

key TKey

Key to get an entry for.

result TValue

out parameter that returns an entry associated with the specified key.

Returns

bool

true when key exists in this heap, otherwise false.