public final class MapUtil extends Object
| Modifier and Type | Field and Description | 
|---|---|
| static SortedMap | EMPTY_SORTED_MAPDesperately missing from  java.util.Collections. | 
| Modifier and Type | Method and Description | 
|---|---|
| static <K,V> Map<K,V> | augment(Map<K,V> delegate,
       K extraKey,
       V extraValue)Returns a  Mapthat is composed of the delegate and one extra entry. | 
| static <K,V> Map<K,V> | combine(Map<K,V> map1,
       Map<? extends K,? extends V> map2)Returns a  Mapthat is composed of map1 and map2, where map1 takes
 precedence over <map2. | 
| static <K,V> SortedMap<K,V> | emptySortedMap()Desperately missing from  java.util.Collections. | 
| static <K,V> Map.Entry<K,V> | entry(K key,
     V initialValue) | 
| static boolean | equal(Object o1,
     Object o2)Deprecated. 
 Moved to  ObjectUtil.equals(Object, Object) | 
| static <K,V> Map<K,V> | fromMappings(Object... keysAndValues)Deprecated. 
 Use  map(Object...)instead | 
| static <K,V> HashMap<K,V> | hashMapOf(int initialCapacity,
         Map.Entry<? extends K,? extends V>... entries) | 
| static <K,V> HashMap<K,V> | hashMapOf(Map.Entry<? extends K,? extends V>... entries)Creates, fills and returns a  HashMap. | 
| static <K,V> Map<K,V> | map(K[] keys,
   V[] values)Returns an unmodifiable map, mapping the given key-value pairs. | 
| static <K,V> Map<K,V> | map(Object... keyValuePairs)Returns an unmodifiable map, mapping the given key-value pairs. | 
| static <K,V> Map<K,V> | override(Map<K,V> delegate,
        K extraKey,
        V extraValue)Returns a  Mapthat is composed of the delegate and one extra entry. | 
| static <K,V,M extends Map<K,V>> | putAll(M subject,
      boolean allowDuplicateKeys,
      Map.Entry<? extends K,? extends V>... entries)Puts all entries into the subject. | 
| static <K,V,M extends Map<K,V>> | putAll(M subject,
      Map.Entry<? extends K,? extends V>... entries)Puts all entries into the subject. | 
| static <K,V> TreeMap<K,V> | treeMapOf(Map.Entry<? extends K,? extends V>... entries) | 
public static final SortedMap EMPTY_SORTED_MAP
java.util.Collections.public static <K,V> Map<K,V> map(Object... keyValuePairs)
null keys and null values are
 supported.keyValuePairs - An alternating sequence of keys and valuesArrayIndexOutOfBoundsException - The length of keyValuePairs is oddIllegalArgumentException - Two of the keys are equalpublic static <K,V> Map<K,V> map(K[] keys, V[] values)
null keys and null values are
 supported.ArrayIndexOutOfBoundsException - The length of keyValuePairs is oddIllegalArgumentException - Two of the keys are equalpublic static <K,V> HashMap<K,V> hashMapOf(Map.Entry<? extends K,? extends V>... entries)
HashMap. The initial capacity of the HashMap is chosen to be
 optimal for the number of entries.HashMap containing all entries/IllegalArgumentException - Two entries have equal keyspublic static <K,V> HashMap<K,V> hashMapOf(int initialCapacity, Map.Entry<? extends K,? extends V>... entries)
initialCapacity - See the documentation of HashMapHashMap containing all entries/IllegalArgumentException - Two entries have equal keyspublic static <K,V> TreeMap<K,V> treeMapOf(Map.Entry<? extends K,? extends V>... entries)
TreeMap containing all entries/IllegalArgumentException - Two entries have equal keyspublic static <K,V,M extends Map<K,V>> M putAll(M subject, Map.Entry<? extends K,? extends V>... entries)
IllegalArgumentException - Two entries have equal keyspublic static <K,V,M extends Map<K,V>> M putAll(M subject, boolean allowDuplicateKeys, Map.Entry<? extends K,? extends V>... entries)
IllegalArgumentException - Two entries have equal keys, and allowDuplicateKeys is
                                  falsepublic static <K,V> Map.Entry<K,V> entry(K key, V initialValue)
Map.Entry with the given key and the
                                           initialValueMap.Entry.setValue(Object)public static <K,V> SortedMap<K,V> emptySortedMap()
java.util.Collections.public static <K,V> Map<K,V> combine(Map<K,V> map1, Map<? extends K,? extends V> map2)
Map that is composed of map1 and map2, where map1 takes
 precedence over <map2.
 All modifying operations are directed to map1; map2 is never modified.
public static <K,V> Map<K,V> augment(Map<K,V> delegate, K extraKey, V extraValue)
Map that is composed of the delegate and one extra entry. If the delegate
 contains the extraKey, then the value from the delegate takes precedence.public static <K,V> Map<K,V> override(Map<K,V> delegate, K extraKey, V extraValue)
Map that is composed of the delegate and one extra entry. If the delegate
 contains the extraKey, then the extraValue takes precedence.@Deprecated public static boolean equal(@Nullable Object o1, @Nullable Object o2)
ObjectUtil.equals(Object, Object)@Deprecated public static <K,V> Map<K,V> fromMappings(Object... keysAndValues)
map(Object...) insteadCopyright © 2018 Arno Unkrig. All rights reserved.