Class MapUtil


  • public final class MapUtil
    extends Object
    Map-related utility methods.
    Since:
    2.0.0
    Author:
    Pascal Essiembre
    • Method Detail

      • toMap

        public static <K,​V> Map<K,​V> toMap​(Object... values)
        Converts a array of values to a map, alternating between key and values.
        Type Parameters:
        K - map key type
        V - map value type
        Parameters:
        values - to convert
        Returns:
        the new map
      • toMap

        public static <K,​V> void toMap​(Map<K,​V> map,
                                             Object... values)
        Populates an existing map with the array of values, alternating between key and values.
        Type Parameters:
        K - map key type
        V - map value type
        Parameters:
        map - the map to fill with values
        values - to convert