Interface IDictionary<K,V>

A dictionary with keys of type K and values of type V. Equivalent to a finite partial map from K to V.

Implements

System.Collections.Generic.IEnumerable<KeyValuePair<K,V>>, System.Collections.IEnumerable, System.IFormattable, System.ICloneable, ICollectionValue<KeyValuePair<K,V>>, IShowable

Implemented by

DictionaryBase<K,V>, GuardedDictionary<K,V>, GuardedSortedDictionary<K,V>, HashDictionary<K,V>, SortedDictionaryBase<K,V>, TreeDictionary<K,V>

Super

ISortedDictionary<K,V>

Property overview

ContainsSpeed ,
EqualityComparer ,
Fun ,
IsReadOnly ,
this[K key] ,
Keys ,
Values

Method overview

Add(K key, V val) ,
AddAll<U,W>(System.Collections.Generic.IEnumerable<KeyValuePair<U,W>> entries) ,
Check() ,
Clear() ,
Contains(K key) ,
ContainsAll<H>(System.Collections.Generic.IEnumerable<H> items) ,
Find(K key, out V val) ,
Find(ref K key, out V val) ,
FindOrAdd(K key, ref V val) ,
Remove(K key) ,
Remove(K key, out V val) ,
Update(K key, V val) ,
Update(K key, V val, out V oldval) ,
UpdateOrAdd(K key, V val) ,
UpdateOrAdd(K key, V val, out V oldval)

Property details

A Speed ContainsSpeedAccess: Read-Only

Value:A characterization of the speed of lookup operations (Contains() etc.) of the implementation of this dictionary.

The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant).

See Speed for the set of symbols.

A System.Collections.Generic.IEqualityComparer<K> EqualityComparerAccess: Read-Only

Value:

The key equalityComparer.
A Fun<K,V> FunAccess: Read-Only

Value:A delegate of type Fun<A1,R> defining the partial function from K to V give by the dictionary.

A bool IsReadOnlyAccess: Read-Only

Value:True if dictionary is read-only

A V this[K key]Access: Read-Write

Value:The value corresponding to the key

Indexer for dictionary.
Throws
NoSuchItemException if no entry is found.
A ICollectionValue<K> KeysAccess: Read-Only

Value:A collection containg the all the keys of the dictionary

A ICollectionValue<V> ValuesAccess: Read-Only

Value:A collection containing all the values of the dictionary

Method details

A void Add(K key, V val) Add a new (key, value) pair (a mapping) to the dictionary.
Throws
DuplicateNotAllowedException if there already is an entry with the same key.
Parameters:
key:Key to add
val:Value to add
A void AddAll<U,W>(System.Collections.Generic.IEnumerable<KeyValuePair<U,W>> entries) Add the entries from a collection of KeyValuePair<K,V> pairs to this dictionary.
Throws
DuplicateNotAllowedException If the input contains duplicate keys or a key already present in this dictionary.
Parameters:
entries:
A bool Check() Check the integrity of the internal data structures of this dictionary. Only avaliable in DEBUG builds???
Returns:True if check does not fail.
A void Clear() Remove all entries from the dictionary
A bool Contains(K key) Check if there is an entry with a specified key
Returns:True if key was found
Parameters:
key:The key to look for
A bool ContainsAll<H>(System.Collections.Generic.IEnumerable<H> items) Check whether this collection contains all the values in another collection. If this collection has bag semantics (AllowsDuplicates==true) the check is made with respect to multiplicities, else multiplicities are not taken into account.
Returns:True if all values in itemsis in this collection.
Parameters:
items:The
A bool Find(K key, out V val) Check if there is an entry with a specified key and report the corresponding value if found. This can be seen as a safe form of "val = this[key]".
Returns:True if key was found
Parameters:
key:The key to look for
val:On exit, the value of the entry
A bool Find(ref K key, out V val) Check if there is an entry with a specified key and report the corresponding value if found. This can be seen as a safe form of "val = this[key]".
Returns:True if key was found
Parameters:
key:The key to look for
val:On exit, the value of the entry
A bool FindOrAdd(K key, ref V val) Look for a specific key in the dictionary. If found, report the corresponding value, else add an entry with the key and the supplied value.
Returns:True if key was found
Parameters:
key:The key to look for
val:On entry the value to add if the key is not found. On exit the value found if any.
A bool Remove(K key) Remove an entry with a given key from the dictionary
Returns:True if an entry was found (and removed)
Parameters:
key:The key of the entry to remove
A bool Remove(K key, out V val) Remove an entry with a given key from the dictionary and report its value.
Returns:True if an entry was found (and removed)
Parameters:
key:The key of the entry to remove
val:On exit, the value of the removed entry
A bool Update(K key, V val) Look for a specific key in the dictionary and if found replace the value with a new one. This can be seen as a non-adding version of "this[key] = val".
Returns:True if key was found
Parameters:
key:The key to look for
val:The new value
A bool Update(K key, V val, out V oldval) Look for a specific key in the dictionary and if found replace the value with a new one. This can be seen as a non-adding version of "this[key] = val" reporting the old value.
Returns:True if key was found
Parameters:
key:The key to look for
val:The new value
oldval:The old value if any
A bool UpdateOrAdd(K key, V val) Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found.
Returns:True if key was found and value updated.
Parameters:
key:The key to look for
val:The value to add or replace with.
A bool UpdateOrAdd(K key, V val, out V oldval) Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found.
Returns:True if key was found and value updated.
Parameters:
key:The key to look for
val:The value to add or replace with.
oldval:The old value if any