Joutsen v0.5.0+18-g5fdf104
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Joutsen.Collections.Generic.MapExtensions Class Reference

Additional (convenience) methods for maps. More...

Static Public Member Functions

static ValueType GetOrAdd< KeyType, ValueType > (this Map< KeyType, ValueType > map, KeyType key, ValueType defaultValue)
 Fetches a value associated with a key or adds a default value if the key does not exists.
 
static ValueType GetAndRemove< KeyType, ValueType > (this Map< KeyType, ValueType > map, KeyType key)
 Fetches a value associated with a key and removes it from the map.
 
static String ToString< KeyType, ValueType > (this Map< KeyType, ValueType > map, int maxNumberOfPrintedCollectionElements=50)
 

Detailed Description

Additional (convenience) methods for maps.

Since
0.5.0

Member Function Documentation

◆ GetAndRemove< KeyType, ValueType >()

static ValueType Joutsen.Collections.Generic.MapExtensions.GetAndRemove< KeyType, ValueType > ( this Map< KeyType, ValueType >  map,
KeyType  key 
)
static

Fetches a value associated with a key and removes it from the map.

Parameters
mapthe map this operation is performed on
keythe key to lookup and return the value
Returns
the value associated with the key

◆ GetOrAdd< KeyType, ValueType >()

static ValueType Joutsen.Collections.Generic.MapExtensions.GetOrAdd< KeyType, ValueType > ( this Map< KeyType, ValueType >  map,
KeyType  key,
ValueType  defaultValue 
)
static

Fetches a value associated with a key or adds a default value if the key does not exists.

Parameters
mapthe map this operation is performed on
keythe key to lookup and return the value for. Also the key used to add the value if it is missing.
defaultValuethe value that will be added to the map if the key does not exist
Returns
the value associated with the key or the defaultValue if the key does not exist

◆ ToString< KeyType, ValueType >()

static String Joutsen.Collections.Generic.MapExtensions.ToString< KeyType, ValueType > ( this Map< KeyType, ValueType >  map,
int  maxNumberOfPrintedCollectionElements = 50 
)
static