Class Index<TContainer, TKey, TValue>
A data structure that memoizes lookups by key in a data structure.
Inheritance
System.Object
Index<TContainer, TKey, TValue>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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
| Improve this Doc 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 |
---|---|---|
System.Func<TContainer, System.Collections.Generic.IEnumerable<System.Collections.Generic.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 |
---|---|---|
System.Func<TContainer, System.Collections.Generic.IEnumerable<System.Collections.Generic.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. |
System.Collections.Generic.IEqualityComparer<TKey> | keyComparer | A comparer for keys. |
Methods
| Improve this Doc 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 |
---|---|
System.Collections.Generic.IReadOnlyList<TValue> | A list of values. |