public final class MapUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <K,V> boolean |
equals(Map<K,V> m1,
Map<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. |
static <K,V> int |
getHashCode(Map<K,V> m1)
Calculates the hash code of the
map. |
static <K,V> void |
merge(Map<K,V> destination,
Map<K,V> source,
BiFunction<V,V,V> valuesMerger)
Merges data from source Map into destination Map using provided function if key exists in both Maps.
|
static <K,V> void |
putIfNotNull(Map<K,V> map,
K key,
V value)
Puts value to map if the value is not null.
|
public static <K,V> boolean equals(Map<K,V> m1, Map<K,V> m2)
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.K - is a type of keysV - is a type of valuesm1 - is the first mapm2 - is the second maptrue if maps are equal and false otherwisepublic static <K,V> void merge(Map<K,V> destination, Map<K,V> source, BiFunction<V,V,V> valuesMerger)
K - is a type of keysV - is a type of valuesdestination - 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.public static <K,V> int getHashCode(Map<K,V> m1)
map.K - is a type of keysV - is a type of valuesm1 - is the mapmap.public static <K,V> void putIfNotNull(Map<K,V> map, K key, V value)
K - is a type of keyV - is a type of valuemap - the map in which value can be pushedkey - the keyvalue - the valueCopyright © 1998–2025 Apryse Group NV. All rights reserved.