public class Maps2
extends java.lang.Object
newLinkedHashMapWithExpectedSize(int)
. Everything else should be obtained from Maps
.Constructor and Description |
---|
Maps2() |
Modifier and Type | Method and Description |
---|---|
static <K,V> java.util.LinkedHashMap<K,V> |
newLinkedHashMapWithExpectedSize(int expectedSize)
Creates a
LinkedHashMap instance, with a high enough "initial capacity" that it should hold
expectedSize elements without growth. |
static <K,V> void |
putAllIntoListMap(K key,
java.util.Collection<? extends V> values,
java.util.Map<? super K,java.util.List<V>> map)
Puts a value into a map that supports lists as values.
|
static <K,V> void |
putIntoListMap(K key,
V value,
java.util.Map<? super K,java.util.List<V>> map)
Puts a value into a map that supports lists as values.
|
static <K,V> void |
putIntoSetMap(K key,
V value,
java.util.Map<? super K,java.util.Set<V>> map)
Puts a value into a map that supports lists as values.
|
public static <K,V> java.util.LinkedHashMap<K,V> newLinkedHashMapWithExpectedSize(int expectedSize)
LinkedHashMap
instance, with a high enough "initial capacity" that it should hold
expectedSize
elements without growth. This behavior cannot be broadly guaranteed, but it is observed to
be true for OpenJDK 1.6. It also can't be guaranteed that the method isn't inadvertently oversizing the
returned map.expectedSize
- the number of elements you expect to add to the returned mapLinkedHashMap
with enough capacity to hold expectedSize
elements without resizingjava.lang.IllegalArgumentException
- if expectedSize
is negativepublic static <K,V> void putIntoListMap(K key, V value, java.util.Map<? super K,java.util.List<V>> map)
public static <K,V> void putIntoSetMap(K key, V value, java.util.Map<? super K,java.util.Set<V>> map)
public static <K,V> void putAllIntoListMap(K key, java.util.Collection<? extends V> values, java.util.Map<? super K,java.util.List<V>> map)