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.
Inherited Members
Namespace: Lucene.Net.Support.C5
Assembly: Lucene.Net.dll
Syntax
public interface IDictionary<K, V> : ICollectionValue<KeyValuePair<K, V>>, IEnumerable<KeyValuePair<K, V>>, IEnumerable, IShowable, IFormattable
Type Parameters
Name | Description |
---|---|
K | |
V |
Properties
| Improve this Doc View SourceContainsSpeed
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 C5.Speed for the set of symbols.
Declaration
Speed ContainsSpeed { get; }
Property Value
Type | Description |
---|---|
Speed | A characterization of the speed of lookup operations ( etc.) of the implementation of this dictionary.
|
EqualityComparer
The key equalityComparer.
Declaration
IEqualityComparer<K> EqualityComparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEqualityComparer<K> |
Func
Declaration
Func<K, V> Func { get; }
Property Value
Type | Description |
---|---|
System.Func<K, V> | A delegate of type Func`2 defining the partial function from K to V give by the dictionary. |
IsReadOnly
Declaration
bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if dictionary is read-only |
Item[K]
Indexer for dictionary.
Declaration
V this[K key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
K | key |
Property Value
Type | Description |
---|---|
V | The value corresponding to the key |
Exceptions
Type | Condition |
---|---|
NoSuchItemException | if no entry is found. |
Keys
Declaration
ICollectionValue<K> Keys { get; }
Property Value
Type | Description |
---|---|
ICollectionValue<K> | A collection containing all the keys of the dictionary |
Values
Declaration
ICollectionValue<V> Values { get; }
Property Value
Type | Description |
---|---|
ICollectionValue<V> | A collection containing all the values of the dictionary |
Methods
| Improve this Doc View SourceAdd(K, V)
Add a new (key, value) pair (a mapping) to the dictionary.
Declaration
void Add(K key, V val)
Parameters
Type | Name | Description |
---|---|---|
K | key | Key to add |
V | val | Value to add |
Exceptions
Type | Condition |
---|---|
DuplicateNotAllowedException | if there already is an entry with the same key. |
AddAll<U, W>(IEnumerable<KeyValuePair<U, W>>)
Add the entries from a collection of C5.KeyValuePair`2 pairs to this dictionary.
Declaration
void AddAll<U, W>(IEnumerable<KeyValuePair<U, W>> entries)
where U : K where W : V
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<KeyValuePair<U, W>> | entries |
Type Parameters
Name | Description |
---|---|
U | |
W |
Exceptions
Type | Condition |
---|---|
DuplicateNotAllowedException | If the input contains duplicate keys or a key already present in this dictionary. |
Check()
Check the integrity of the internal data structures of this dictionary. Only available in DEBUG builds???
Declaration
bool Check()
Returns
Type | Description |
---|---|
System.Boolean | True if check does not fail. |
Clear()
Remove all entries from the dictionary
Declaration
void Clear()
Contains(K)
Check if there is an entry with a specified key
Declaration
bool Contains(K key)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found |
ContainsAll<H>(IEnumerable<H>)
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.
Declaration
bool ContainsAll<H>(IEnumerable<H> items)
where H : K
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<H> | items | The |
Returns
Type | Description |
---|---|
System.Boolean | True if all values in is in this collection.
|
Type Parameters
Name | Description |
---|---|
H |
Find(ref K, out V)
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]".
Declaration
bool Find(ref K key, out V val)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | On exit, the value of the entry |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found |
FindOrAdd(K, ref V)
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.
Declaration
bool FindOrAdd(K key, ref V val)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | On entry the value to add if the key is not found. On exit the value found if any. |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found |
Remove(K)
Remove an entry with a given key from the dictionary
Declaration
bool Remove(K key)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key of the entry to remove |
Returns
Type | Description |
---|---|
System.Boolean | True if an entry was found (and removed) |
Remove(K, out V)
Remove an entry with a given key from the dictionary and report its value.
Declaration
bool Remove(K key, out V val)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key of the entry to remove |
V | val | On exit, the value of the removed entry |
Returns
Type | Description |
---|---|
System.Boolean | True if an entry was found (and removed) |
Update(K, V)
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".
Declaration
bool Update(K key, V val)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | The new value |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found |
Update(K, V, out V)
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.
Declaration
bool Update(K key, V val, out V oldval)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | The new value |
V | oldval | The old value if any |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found |
UpdateOrAdd(K, V)
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.
Declaration
bool UpdateOrAdd(K key, V val)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | The value to add or replace with. |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found and value updated. |
UpdateOrAdd(K, V, out V)
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.
Declaration
bool UpdateOrAdd(K key, V val, out V oldval)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | The value to add or replace with. |
V | oldval | The old value if any |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found and value updated. |