Class Index<TContainer, TKey, TValue>
A data structure that memoizes lookups by key in a data structure.
Inherited Members
Namespace: Flame.Collections
Assembly: Flame.dll
Syntax
public sealed class Index<TContainer, TKey, TValue> where TContainer : class
Type Parameters
| Name | Description |
|---|---|
| TContainer | The type of data structure to look up values in. |
| TKey | The type of key with which values can be looked up. |
| TValue | The type of value to look up. |
Constructors
| Edit this page View SourceIndex(Func<TContainer, IEnumerable<KeyValuePair<TKey, TValue>>>)
Creates an index.
Declaration
public Index(Func<TContainer, IEnumerable<KeyValuePair<TKey, TValue>>> getElements)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TContainer, IEnumerable<KeyValuePair<TKey, TValue>>> | getElements | Takes a container and returns its contents as a sequence of key-value pairs. A single key may occur more than once in the output. |
Index(Func<TContainer, IEnumerable<KeyValuePair<TKey, TValue>>>, IEqualityComparer<TKey>)
Creates an index.
Declaration
public Index(Func<TContainer, IEnumerable<KeyValuePair<TKey, TValue>>> getElements, IEqualityComparer<TKey> keyComparer)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TContainer, IEnumerable<KeyValuePair<TKey, TValue>>> | getElements | Takes a container and returns its contents as a sequence of key-value pairs. A single key may occur more than once in the output. |
| IEqualityComparer<TKey> | keyComparer | A comparer for keys. |
Methods
| Edit this page View SourceGetAll(TContainer, TKey)
Gets a list of all values in a container that are tagged with a particular key.
Declaration
public IReadOnlyList<TValue> GetAll(TContainer container, TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TContainer | container | The container to search. |
| TKey | key | The key to look for. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<TValue> | A list of values. |