Class MultivaluedMapUtils

    • Method Detail

      • toSingleValuedMap

        public static <K,​V> Map<K,​V> toSingleValuedMap​(Map<K,​List<V>> map)
        Converts the specified multi-valued map to a single-valued map by taking the first value in the list.
        Parameters:
        map - The multi-valued map, null if not specified.
        Returns:
        The single-valued map, null if no map was specified.
      • getFirstValue

        public static <K,​V> V getFirstValue​(Map<K,​List<V>> map,
                                                  K key)
        Gets the first value for the specified key.
        Parameters:
        map - The multi-valued map. Must not be null.
        key - The key. Must not be null.
        Returns:
        The first value, null if not set.
      • removeAndReturnFirstValue

        public static <K,​V> V removeAndReturnFirstValue​(Map<K,​List<V>> map,
                                                              String key)
        Removes the entry for the specified key and returns its first value.
        Parameters:
        map - The multi-valued map. Must not be null.
        key - The key. Must not be null.
        Returns:
        The first value, null if not set.