Class Maps2
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.util.Maps2
-
public class Maps2 extends java.lang.ObjectProvidesnewLinkedHashMapWithExpectedSize(int). Everything else should be obtained fromMaps.
-
-
Constructor Summary
Constructors Constructor Description Maps2()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
java.util.LinkedHashMap<K,V>newLinkedHashMapWithExpectedSize(int expectedSize)Creates aLinkedHashMapinstance, with a high enough "initial capacity" that it should holdexpectedSizeelements without growth.static <K,V>
voidputAllIntoListMap(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>
voidputIntoListMap(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>
voidputIntoSetMap(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.
-
-
-
Method Detail
-
newLinkedHashMapWithExpectedSize
public static <K,V> java.util.LinkedHashMap<K,V> newLinkedHashMapWithExpectedSize(int expectedSize)
Creates aLinkedHashMapinstance, with a high enough "initial capacity" that it should holdexpectedSizeelements 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.- Parameters:
expectedSize- the number of elements you expect to add to the returned map- Returns:
- a new, empty
LinkedHashMapwith enough capacity to holdexpectedSizeelements without resizing - Throws:
java.lang.IllegalArgumentException- ifexpectedSizeis negative
-
putIntoListMap
public 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. The list is created on-demand.
-
putIntoSetMap
public 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. The list is created on-demand.
-
putAllIntoListMap
public 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. The list is created on-demand.
-
-