Joutsen v0.5.0+12-g5dd5f7e
Public Member Functions | List of all members
Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType > Class Template Reference

A map implementation that uses the hashes of keys to store and find items. More...

Public Member Functions

 ConcurrentDictionary ()
 Creates an empty dictionary. More...
 
 ConcurrentDictionary (Map< KeyType, ValueType > map)
 Creates a new dictionary with predefined entries. More...
 
 ConcurrentDictionary (SCG.IEqualityComparer< KeyType > keyComparer)
 Creates a new dictionary using a custom comparer to calculate hashes. More...
 
 ConcurrentDictionary (int concurrencyLevel, int initialCapacity)
 Creates a new dictionary with a custom initial size of the hash table. More...
 
 ConcurrentDictionary (Map< KeyType, ValueType > map, SCG.IEqualityComparer< KeyType > keyComparer)
 Creates a new dictionary using predefined initial items and a custom comparer to calculate hashes. More...
 
 ConcurrentDictionary (int concurrencyLevel, int initialCapacity, SCG.IEqualityComparer< KeyType > keyComparer)
 Creates a new dictionary with a custom comparer to calculate hashes and a custom internal capacity. More...
 
void Add (KeyType key, ValueType value)
 
ValueType GetValue (KeyType key, ValueType defaultValue)
 Fetches the value associated with a key or a default value. More...
 
void Update (SCG.IEnumerable< SCG.KeyValuePair< KeyType, ValueType > > newValues)
 Adds or updates values in the map. More...
 
override String ToString ()
 
- Public Member Functions inherited from Joutsen.Collections.Generic.Map< KeyType, ValueType >
void Update (SCG.IEnumerable< SCG.KeyValuePair< KeyType, ValueType > > newValues)
 Adds or updates values in the map. More...
 
new bool ContainsKey (KeyType key)
 Checks if a key is part of the map. More...
 
- Public Member Functions inherited from Joutsen.Collections.Generic.Collection< SCG.KeyValuePair< KeyType, ValueType > >
bool Contains (ItemType item, SCG.IEqualityComparer< ItemType > comparer)
 Checks if an item is part of the collection. More...
 
void Add (SCG.IEnumerable< ItemType > items)
 Adds multiple items to the collection. More...
 
- Public Member Functions inherited from Joutsen.Collections.Generic.Mapping< KeyType, ValueType >
bool ContainsKey (KeyType key)
 Checks if a key is part of the mapping. More...
 
ValueType GetValue (KeyType key, ValueType defaultValue)
 Fetches the value associated with a key or a default value. More...
 
bool TryGetValue (KeyType key, out ValueType value)
 Get a value if the key is part of the mapping. More...
 
- Public Member Functions inherited from Joutsen.Collections.Generic.Indexable< KeyType, ValueType >
IndexType IndexOf (ItemType item)
 Fetches the index of an itemin the list. More...
 
IndexType IndexOf (ItemType item, IEqualityComparer< ItemType > comparer)
 Fetches the index of an item in the list using a custom comparer. More...
 

Additional Inherited Members

- Properties inherited from Joutsen.Collections.Generic.Map< KeyType, ValueType >
new ValueType this[KeyType key] [get, set]
 Fetches a or sets a value associated with a key. More...
 
new int Count [get]
 Fetches the number of elements in the map. More...
 
new SCG.IEnumerable< ValueType > Values [get]
 Fetches an iterator for the values in the mapping. More...
 
- Properties inherited from Joutsen.Collections.Generic.Mapping< KeyType, ValueType >
ValueType this[KeyType key] [get]
 Fetches a value associated with a key. More...
 
IEnumerable< KeyType > Keys [get]
 Fetches an iterator for the keys in the mapping. More...
 
IEnumerable< ValueType > Values [get]
 Fetches an iterator for the values in the mapping. More...
 
int Count [get]
 Fetches the number of elements in the mapping. More...
 
- Properties inherited from Joutsen.Collections.Generic.Indexable< KeyType, ValueType >
int Count [get]
 Determines the number of values in the list. More...
 
ItemType this[IndexType index] [get]
 Fetches the value associated with the index. More...
 

Detailed Description

A map implementation that uses the hashes of keys to store and find items.

Since
0.4.0

Constructor & Destructor Documentation

◆ ConcurrentDictionary() [1/6]

Creates an empty dictionary.

◆ ConcurrentDictionary() [2/6]

Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.ConcurrentDictionary ( Map< KeyType, ValueType >  map)

Creates a new dictionary with predefined entries.

Parameters
mapthe predefined entries of the dictionary

◆ ConcurrentDictionary() [3/6]

Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.ConcurrentDictionary ( SCG.IEqualityComparer< KeyType >  keyComparer)

Creates a new dictionary using a custom comparer to calculate hashes.

Parameters
comparerthe custom comparer

◆ ConcurrentDictionary() [4/6]

Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.ConcurrentDictionary ( int  concurrencyLevel,
int  initialCapacity 
)

Creates a new dictionary with a custom initial size of the hash table.

Parameters
initialCapacitythe initial capacity of the internal hashtable

◆ ConcurrentDictionary() [5/6]

Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.ConcurrentDictionary ( Map< KeyType, ValueType >  map,
SCG.IEqualityComparer< KeyType >  keyComparer 
)

Creates a new dictionary using predefined initial items and a custom comparer to calculate hashes.

Parameters
mapthe predefined entries of the dictionary
comparerthe custom comparer

◆ ConcurrentDictionary() [6/6]

Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.ConcurrentDictionary ( int  concurrencyLevel,
int  initialCapacity,
SCG.IEqualityComparer< KeyType >  keyComparer 
)

Creates a new dictionary with a custom comparer to calculate hashes and a custom internal capacity.

Parameters
initialCapacitythe initial capacity of the internal hashtable
comparerthe custom comparer

Member Function Documentation

◆ Add()

void Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.Add ( KeyType  key,
ValueType  value 
)

◆ GetValue()

ValueType Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.GetValue ( KeyType  key,
ValueType  defaultValue 
)

Fetches the value associated with a key or a default value.

Parameters
keythe key associated with the value to retrieve
defaultValuethe value to return if the key is not found in the map
Returns
the value associated with the key or the default value if the key is not found

Implements Joutsen.Collections.Generic.Mapping< KeyType, ValueType >.

◆ ToString()

override String Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.ToString ( )

◆ Update()

void Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >.Update ( SCG.IEnumerable< SCG.KeyValuePair< KeyType, ValueType > >  newValues)

Adds or updates values in the map.

Parameters
newValuesthe pairs that are used to modify the map
Remarks
All values whose associated key exists in the map are updated with the new values. Any key that does not exist is added along with the value associated with it. This method does not delete any keys.

Implements Joutsen.Collections.Generic.Map< KeyType, ValueType >.