Class MapUtil


  • public class MapUtil
    extends Object
    Author:
    Yohann Chastagnier
    • Method Detail

      • putAddAll

        public static <K,​V> Collection<V> putAddAll​(Class<? extends Collection> collectionClass,
                                                          Map<K,​Collection<V>> map,
                                                          K key,
                                                          Collection<V> values)
        Centralizes the map adding that containing collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        values -
        Returns:
      • putAdd

        public static <K,​V> Collection<V> putAdd​(Class<? extends Collection> collectionClass,
                                                       Map<K,​Collection<V>> map,
                                                       K key,
                                                       V value)
        Centralizes the map adding that containing collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        value -
        Returns:
      • putAddAllList

        public static <K,​V> List<V> putAddAllList​(Map<K,​List<V>> map,
                                                        K key,
                                                        Collection<V> values)
        Centralizes the map adding that containing list collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        values -
        Returns:
      • putAddList

        public static <K,​V> List<V> putAddList​(Map<K,​List<V>> map,
                                                     K key,
                                                     V value)
        Centralizes the map adding that containing list collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        value -
        Returns:
      • putAddAllSet

        public static <K,​V> Set<V> putAddAllSet​(Map<K,​Set<V>> map,
                                                      K key,
                                                      Collection<V> values)
        Centralizes the map adding that containing list collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        values -
        Returns:
      • putAddSet

        public static <K,​V> Set<V> putAddSet​(Map<K,​Set<V>> map,
                                                   K key,
                                                   V value)
        Centralizes the map adding that containing set collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        value -
        Returns:
      • putAddAllList

        public static <K,​V> List<V> putAddAllList​(Class<? extends List> listClass,
                                                        Map<K,​List<V>> map,
                                                        K key,
                                                        Collection<V> values)
        Centralizes the map adding that containing list collections
        Type Parameters:
        K -
        V -
        Parameters:
        listClass -
        map -
        key -
        values -
        Returns:
      • putAddList

        public static <K,​V> List<V> putAddList​(Class<? extends List> listClass,
                                                     Map<K,​List<V>> map,
                                                     K key,
                                                     V value)
        Centralizes the map adding that containing list collections
        Type Parameters:
        K -
        V -
        Parameters:
        listClass -
        map -
        key -
        value -
        Returns:
      • putAddAllSet

        public static <K,​V> Set<V> putAddAllSet​(Class<? extends Set> setClass,
                                                      Map<K,​Set<V>> map,
                                                      K key,
                                                      Collection<V> values)
        Centralizes the map adding that containing list collections
        Type Parameters:
        K -
        V -
        Parameters:
        setClass -
        map -
        key -
        values -
        Returns:
      • putAddSet

        public static <K,​V> Set<V> putAddSet​(Class<? extends Set> setClass,
                                                   Map<K,​Set<V>> map,
                                                   K key,
                                                   V value)
        Centralizes the map adding that containing set collections
        Type Parameters:
        K -
        V -
        Parameters:
        setClass -
        map -
        key -
        value -
        Returns:
      • removeValueList

        public static <K,​V> List<V> removeValueList​(Map<K,​List<V>> map,
                                                          K key,
                                                          V value)
        Centralizes the map removing that containing list collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        value -
        Returns:
      • removeValueSet

        public static <K,​V> Set<V> removeValueSet​(Map<K,​Set<V>> map,
                                                        K key,
                                                        V value)
        Centralizes the map removing that containing set collections
        Type Parameters:
        K -
        V -
        Parameters:
        map -
        key -
        value -
        Returns:
      • areEqual

        public static <K,​V> boolean areEqual​(Map<? extends K,​? extends V> left,
                                                   Map<? extends K,​? extends V> right)