Class MapUtils


  • public final class MapUtils
    extends Object
    Utility methods for maps.
    Author:
    cortiz
    • Method Detail

      • deepMerge

        public static Map deepMerge​(Map dst,
                                    Map src)
        Deep merges two maps
        Parameters:
        dst - the map where elements will be merged into
        src - 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 map
        key - the key
        value - the value to add