Joutsen v0.5.0+12-g5dd5f7e
Public Member Functions | Properties | List of all members
Joutsen.Collections.Generic.Mapping< KeyType, ValueType > Interface Template Reference

A collection of key-value association that can only be read. More...

Public Member Functions

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...
 

Properties

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...
 

Detailed Description

A collection of key-value association that can only be read.

Since
0.4.2

Member Function Documentation

◆ ContainsKey()

bool Joutsen.Collections.Generic.Mapping< KeyType, ValueType >.ContainsKey ( KeyType  key)

◆ GetValue()

ValueType Joutsen.Collections.Generic.Mapping< 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

Implemented in Joutsen.Collections.Generic.Compatibility.MapAdapter< KeyType, ValueType >, Joutsen.Collections.Concurrent.ConcurrentDictionary< KeyType, ValueType >, Joutsen.Collections.Generic.BidirectionalDictionary< KeyType, ValueType >, Joutsen.Collections.Generic.Dictionary< KeyType, ValueType >, Joutsen.Collections.Generic.SortedDictionary< KeyType, ValueType >, and Joutsen.Collections.Generic.ReadOnlyMap< KeyType, ValueType >.

◆ TryGetValue()

bool Joutsen.Collections.Generic.Mapping< KeyType, ValueType >.TryGetValue ( KeyType  key,
out ValueType  value 
)

Get a value if the key is part of the mapping.

Parameters
keythe key to lookup in the mapping
valuethe output parameter that will contain the value associated with the key if it is part orf the mapping
Returns
true if the key is part of the mapping, otherwise false

Implemented in Joutsen.Collections.Generic.Compatibility.MapAdapter< KeyType, ValueType >, Joutsen.Collections.Generic.BidirectionalDictionary< KeyType, ValueType >, and Joutsen.Collections.Generic.ReadOnlyMap< KeyType, ValueType >.

Property Documentation

◆ Count

int Joutsen.Collections.Generic.Mapping< KeyType, ValueType >.Count
get

◆ Keys

IEnumerable<KeyType> Joutsen.Collections.Generic.Mapping< KeyType, ValueType >.Keys
get

◆ this[KeyType key]

ValueType Joutsen.Collections.Generic.Mapping< KeyType, ValueType >.this[KeyType key]
get

◆ Values

IEnumerable<ValueType> Joutsen.Collections.Generic.Mapping< KeyType, ValueType >.Values
get