Package com.itextpdf.commons.utils
Class MapUtil
java.lang.Object
com.itextpdf.commons.utils.MapUtil
Utility class for work with collections. Not for public use.
-
Method Summary
Modifier and TypeMethodDescriptionstaticV> boolean Checks if twomapsare 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.staticV> int getHashCode(Map V> m1) Calculates the hash code of themap.staticV> void merge(Map V> destination, Map V> source, BiFunction V, V> valuesMerger) Merges data from source Map into destination Map using provided function if key exists in both Maps.staticV> void putIfNotNull(Map V> map, K key, V value) Puts value to map if the value is not null.
-
Method Details
-
equals
Checks if twomapsare 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.- Type Parameters:
-
K- is a type of keys -
V- is a type of values - Parameters:
-
m1- is the first map -
m2- is the second map - Returns:
-
trueif maps are equal andfalseotherwise
-
merge
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.- Type Parameters:
-
K- is a type of keys -
V- is a type of values - 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.
-
getHashCode
Calculates the hash code of themap.- Type Parameters:
-
K- is a type of keys -
V- is a type of values - Parameters:
-
m1- is the map - Returns:
-
the hash code of the
map.
-
putIfNotNull
Puts value to map if the value is not null.- Type Parameters:
-
K- is a type of key -
V- is a type of value - Parameters:
-
map- the map in which value can be pushed -
key- the key -
value- the value
-