Class MapUtils
- java.lang.Object
-
- org.craftercms.commons.collections.MapUtils
-
public final class MapUtils extends Object
Utility methods for maps.- Author:
- cortiz
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K> void
add(Map<K,Object> map, K key, Object value)
Adds the value under the specified key in the map.static Map
deepMerge(Map dst, Map src)
Deep merges two maps
-
-
-
Method Detail
-
deepMerge
public static Map deepMerge(Map dst, Map src)
Deep merges two maps- Parameters:
dst
- the map where elements will be merged intosrc
- the map with the elements to merge- Returns:
- a deep merge of the two given maps.
-
add
public static <K> void add(Map<K,Object> map, K key, Object value)
Adds the value under the specified key in the map. If there's no value in the map with the key, the value is put as is. If there's already a value, the original and the new value are added to a collection and put under the key.- Parameters:
map
- the mapkey
- the keyvalue
- the value to add
-
-