iText 8.0.2 API
iText.Commons.Utils.MapUtil Class Reference

Utility class for work with collections. More...

Static Public Member Functions

static bool  Equals< K, V > (IDictionary< K, V > m1, IDictionary< K, V > m2)
  Checks if two maps are equal: the are of the same types and has equal number of stored entries and both has the same set of keys ans each key is associated with an appropriate value. More...
 
static void  Merge< K, V > (IDictionary< K, V > destination, IDictionary< K, V > source, Func< V, V, V > valuesMerger)
  Merges data from source Map into destination Map using provided function if key exists in both Maps. More...
 
static int  GetHashCode< K, V > (IDictionary< K, V > m1)
  Calculates the hash code of the map. More...
 
static void  PutIfNotNull< K, V > (IDictionary< K, V > map, K key, V value)
  Puts value to map if the value is not null. More...
 

Detailed Description

Utility class for work with collections.

Utility class for work with collections. Not for public use.

Member Function Documentation

◆ Equals< K, V >()

static bool iText.Commons.Utils.MapUtil.Equals< K, V > ( IDictionary< K, V >  m1,
IDictionary< K, V >  m2 
)
inlinestatic

Checks if two maps are equal: the are of the same types and has equal number of stored entries and both has the same set of keys ans each key is associated with an appropriate value.

Parameters
m1 is the first map
m2 is the second map
Template Parameters
K is a type of keys
V is a type of values
Returns

true if maps are equal and false otherwise

◆ GetHashCode< K, V >()

static int iText.Commons.Utils.MapUtil.GetHashCode< K, V > ( IDictionary< K, V >  m1 )
inlinestatic

Calculates the hash code of the map.

Parameters
m1 is the map
Template Parameters
K is a type of keys
V is a type of values
Returns
the hash code of the map.

◆ Merge< K, V >()

static void iText.Commons.Utils.MapUtil.Merge< K, V > ( IDictionary< K, V >  destination,
IDictionary< K, V >  source,
Func< V, V, V >  valuesMerger 
)
inlinestatic

Merges data from source Map into destination Map using provided function if key exists in both Maps.

Merges data from source Map into destination Map using provided function if key exists in both Maps. If key doesn't exist in destination Map in will be putted directly.

Parameters
destination Map to which data will be merged.
source Map from which data will be taken.
valuesMerger function which will be used to merge Maps values.
Template Parameters
K is a type of keys
V is a type of values

◆ PutIfNotNull< K, V >()

static void iText.Commons.Utils.MapUtil.PutIfNotNull< K, V > ( IDictionary< K, V >  map,
key,
value 
)
inlinestatic

Puts value to map if the value is not null.

Parameters
map the map in which value can be pushed
key the key
value the value
Template Parameters
K is a type of key
V is a type of value