A multimap is a dictionary that allows more than one value to be associated with each key. This is much more convenient than a Dictionary of Lists of values, because the indexer always returns a collection (empty if there are no values associated with a key) and its methods automatically create or destroy, as appropriate, the list associated with each key.
More...
A multimap is a dictionary that allows more than one value to be associated with each key. This is much more convenient than a Dictionary of Lists of values, because the indexer always returns a collection (empty if there are no values associated with a key) and its methods automatically create or destroy, as appropriate, the list associated with each key.
This class is implemented using a Dictionary whose entries have lists of values.
This class keeps track of the number of values as well as the number of keys. The Count property returns the number of values, while KeyCount returns the number of keys. The number of values is never less than the number of keys, because the collection associated with a key is always removed when its last item is removed.
|
|
| MultiMap (IEnumerable< KeyValuePair< K, V >> pairs, IEqualityComparer< K >?comp=null) |
| |
|
| MultiMap (Dictionary< K, List< V >> dict) |
| |
|
| MultiMap (MultiMap< K, V > map) |
| |
|
| MultiMap (IEqualityComparer< K >?comp) |
| |
|
bool | ContainsKey (K key) |
| |
|
IEnumerator< KeyValuePair< K, V > > | GetEnumerator () |
| |
| bool | TryGetValue (K key, [MaybeNullWhen(false)] out ValueList value) |
| | The collection returned is always valid, but the method returns true only if the collection is not empty. More...
|
| |
|
void | Add (KeyValuePair< K, V > item) |
| |
|
void | Clear () |
| |
|
bool | Contains (KeyValuePair< K, V > item) |
| |
|
void | CopyTo (KeyValuePair< K, V >[] array, int arrayIndex) |
| |
|
bool | Remove (KeyValuePair< K, V > item) |
| |
|
bool | Remove (K key) |
| |
|
MultiMap< K, V > | Clone () |
| |
| void | CopyTo (T[] array, int arrayIndex) |
| | Copies the elements of the collection to an Array, starting at a particular array index. More...
|
| |
| bool | Contains (T item) |
| | Returns true if and only if the collection contains the specified item. More...
|
| |
|
bool | Remove (T item) |
| |
|
void | Add (T item) |
| |