Class MapUtils


  • public final class MapUtils
    extends Object

    Class that helps adds some comfort functions to Maps with the usage of Streams

    Since:
    2.0
    Author:
    Andreas Pointner
    • Method Detail

      • prefixMapKey

        public static <V> Map<String,​V> prefixMapKey​(Map<String,​V> input,
                                                           String prefix)
        This function clones the map and add a prefix to all keys from the new map. so if input is a map with one element e.g. test -> myObj and prefix is aist_ the result would be a map with one element with aist_test -> myObj
        Type Parameters:
        V - type of the value of the map
        Parameters:
        input - the map
        prefix - the prefix to be added
        Returns:
        the new map
      • mapOfValues

        @SafeVarargs
        public static <K,​V> Map<K,​V> mapOfValues​(Pair<K,​V>... pairs)
        Creates a Map out of pairs
        Type Parameters:
        K - the type of the key
        V - the type of the value
        Parameters:
        pairs - the key value pairs
        Returns:
        the resulting map