An immutable dictionary.
This class is a read-only dictionary, known in comp-sci nerd speak as a "persistent" data structure (not to be confused with the normal meaning of "persistent" as something that is saved to disk–this data structure is designed only to exist in memory). Map
allows modification only by creating new dictionaries. To create new dictionaries, this class provides the following methods:
-
Union, Intersect, Except and Xor combine two dictionaries to create a new dictionary, without modifying either of the original dictionaries.
-
With and Without create a new dictionary with a single item added or removed.
-
A C# cast operator is provided to convert a Map into an MMap{K,V}.
See MMap{K,V} and InternalSet{T} for more information.
|
| Map () |
| Creates an empty map. Consider using Empty instead. More...
|
|
| Map (IEqualityComparer< K > comparer) |
| Creates an empty map with the specified key comparer. More...
|
|
| Map (IEnumerable< KeyValuePair< K, V >> list) |
| Creates a map with the specified elements. More...
|
|
| Map (IEnumerable< KeyValuePair< K, V >> list, IEqualityComparer< K > comparer) |
| Creates a map with the specified elements and key comparer. More...
|
|
Map< K, V > | With (K key, V value, bool replaceIfPresent=true) |
| Returns a copy of the current map with an additional key-value pair. More...
|
|
Map< K, V > | Without (K key) |
| Returns a copy of the current map without the specified key. More...
|
|
Map< K, V > | With (KeyValuePair< K, V > item) |
|
Map< K, V > | Union (MapOrMMap< K, V > other) |
| Returns a copy of the current map with the specified items added; each item is added only if the key is not already present. More...
|
|
Map< K, V > | Union (MapOrMMap< K, V > other, bool replaceWithValuesFromOther) |
| Returns a copy of the current map with the specified items added. More...
|
|
Map< K, V > | Intersect (MapOrMMap< K, V > other) |
| Returns a copy of the current map with all keys removed from this map that are not present in the other map. The Values in 'other' are ignored. More...
|
|
Map< K, V > | Except (MapOrMMap< K, V > other) |
| Returns a copy of the current map with all keys removed from this map that are present in the other map. The Values in 'other' are ignored. More...
|
|
Map< K, V > | Xor (MapOrMMap< K, V > other) |
| Duplicates the current map and then modifies it so that it contains only keys that are present either in the current map or in the specified other map, but not both. More...
|
|
MMap< K, V > | AsMutable () |
|
bool | ContainsKey (K key) |
|
bool | TryGetValue (K key, out V value) |
|
bool | Contains (KeyValuePair< K, V > item) |
|
void | CopyTo (KeyValuePair< K, V >[] array, int arrayIndex) |
|
InternalSet< KeyValuePair< K,
V > >.Enumerator | GetEnumerator () |
|
V | TryGetValue (K key, V defaultValue) |
| Synonym for this[key, defaultValue]. More...
|
|
virtual long | CountMemory (int sizeOfPair) |
| Measures the total size of all objects allocated to this collection, in bytes, including the size of this object itself; see InternalSet{T}.CountMemory. More...
|
|
OutSetT | With (T item) |
|
OutSetT | Without (T item) |
|
OutSetT | Union (InSetT other) |
|
OutSetT | Intersect (InSetT other) |
|
OutSetT | Except (InSetT other) |
|
OutSetT | Xor (InSetT other) |
|