Package de.alpharogroup.collections.map
Class MapFactory
- java.lang.Object
-
- de.alpharogroup.collections.map.MapFactory
-
public final class MapFactory extends java.lang.ObjectThe factory classMapFactoryprovides factory methods for create newMapobjects
-
-
Constructor Summary
Constructors Constructor Description MapFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.String>>newAssosiativeArrayMap()Factory method forMapthat acts like a javascript associative array.static <K,V>
java.util.concurrent.ConcurrentHashMap<K,V>newConcurrentHashMap()Factory method for create a newConcurrentHashMapstatic <K,V>
java.util.concurrent.ConcurrentHashMap<K,V>newConcurrentHashMap(int initialCapacity)Factory method for create a newConcurrentHashMapstatic <K,V>
java.util.concurrent.ConcurrentHashMap<K,V>newConcurrentHashMap(@NonNull java.util.Map<K,V> map)Factory method for create a newConcurrentHashMapstatic <K> java.util.Map<K,java.lang.Integer>newCounterMap(@NonNull java.util.Collection<K> elements)Factory method for create a map for counting elements of the given collectionstatic <K,V>
java.util.Map<K,V>newHashMap()Factory method for create a newHashMapstatic <K,V>
java.util.Map<K,V>newHashMap(int initialCapacity)Factory method for create a newHashMapstatic <K,V>
java.util.Map<K,V>newHashMap(@NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newHashMapstatic <K,V>
java.util.Map<K,V>newHashMap(@NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newHashMapstatic <K,V>
java.util.Map<K,V>newHashMap(@NonNull java.util.Map<K,V> map)Factory method for create a newHashMapstatic <K,V>
java.util.Map<K,V>newInsertionOrderMap()Factory method for create a newInsertionOrderMapstatic <K,V>
java.util.Map<K,V>newInsertionOrderMap(int initialCapacity)Factory method for create a newInsertionOrderMapstatic <K,V>
java.util.Map<K,V>newInsertionOrderMap(@NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newInsertionOrderMapstatic <K,V>
java.util.Map<K,V>newInsertionOrderMap(@NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newInsertionOrderMapstatic <K,V>
java.util.Map<K,V>newInsertionOrderMap(@NonNull java.util.Map<K,V> map)Factory method for create a newInsertionOrderMapstatic <K,V>
java.util.Map<K,V>newLazyHashMap()Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aHashMapstatic <K,V>
java.util.Map<K,V>newLazyHashMap(java.util.HashMap<K,V> map)Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aHashMapstatic <K,V>
java.util.Map<K,V>newLazyMap()Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aHashMapstatic <K,V>
java.util.Map<K,V>newLazyTreeMap()Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aTreeMapstatic <K,V>
java.util.Map<K,V>newLazyTreeMap(@NonNull java.util.Comparator<? super K> comparator)Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aTreeMapstatic <K,V>
java.util.Map<K,V>newLazyTreeMap(@NonNull java.util.TreeMap<K,V> map)Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aTreeMapstatic <K,V>
java.util.Map<K,V>newLinkedHashMap()Factory method for create a newLinkedHashMapstatic <K,V>
java.util.Map<K,V>newLinkedHashMap(int initialCapacity)Factory method for create a newLinkedHashMapstatic <K,V>
java.util.Map<K,V>newLinkedHashMap(@NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newLinkedHashMapstatic <K,V>
java.util.Map<K,V>newLinkedHashMap(@NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newLinkedHashMapstatic <K,V>
java.util.Map<K,V>newLinkedHashMap(@NonNull java.util.Map<K,V> map)Factory method for create a newLinkedHashMapstatic <K,V>
java.util.Map<K,V>newTreeMap()Factory method for create a newTreeMapstatic <K,V>
java.util.Map<K,V>newTreeMap(@NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newTreeMapstatic <K,V>
java.util.Map<K,V>newTreeMap(@NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newTreeMapstatic <K,V>
java.util.Map<K,V>newTreeMap(@NonNull java.util.Comparator<? super K> comparator)Factory method for create a newTreeMapstatic <K,V>
java.util.Map<K,V>newTreeMap(@NonNull java.util.Comparator<? super K> comparator, @NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newTreeMapstatic <K,V>
java.util.Map<K,V>newTreeMap(@NonNull java.util.Comparator<? super K> comparator, @NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newTreeMapstatic <K,V>
java.util.Map<K,V>newTreeMap(@NonNull java.util.Map<K,V> map)Factory method for create a newTreeMap
-
-
-
Method Detail
-
newCounterMap
public static <K> java.util.Map<K,java.lang.Integer> newCounterMap(@NonNull @NonNull java.util.Collection<K> elements)Factory method for create a map for counting elements of the given collection- Type Parameters:
K- the generic type of the elements- Parameters:
elements- the elements- Returns:
- the new map ready to count elements
-
newInsertionOrderMap
public static <K,V> java.util.Map<K,V> newInsertionOrderMap()
Factory method for create a newInsertionOrderMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
InsertionOrderMap
-
newInsertionOrderMap
public static <K,V> java.util.Map<K,V> newInsertionOrderMap(int initialCapacity)
Factory method for create a newInsertionOrderMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
initialCapacity- the initial capacity- Returns:
- The new
InsertionOrderMap
-
newInsertionOrderMap
public static <K,V> java.util.Map<K,V> newInsertionOrderMap(@NonNull @NonNull java.util.Map<K,V> map)Factory method for create a newInsertionOrderMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
map- the map- Returns:
- The new
InsertionOrderMap
-
newInsertionOrderMap
public static <K,V> java.util.Map<K,V> newInsertionOrderMap(@NonNull @NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newInsertionOrderMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the collection with the key value pairs- Returns:
- The new
InsertionOrderMap
-
newInsertionOrderMap
@SafeVarargs public static <K,V> java.util.Map<K,V> newInsertionOrderMap(@NonNull @NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newInsertionOrderMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the key value pairs to add in the newInsertionOrderMap- Returns:
- The new
InsertionOrderMap
-
newAssosiativeArrayMap
public static java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.String>> newAssosiativeArrayMap()
Factory method forMapthat acts like a javascript associative array. This Map is the counterpart for the associative array in js. For instance: in js you can create and fetch associative arrays like this:$arrayObj[0]['firstName'] = 'Albert'; $arrayObj[0]['lastName'] = 'Einstein'; $arrayObj[1]['firstName'] = 'Neil'; $arrayObj[0]['lastName'] = 'Armstrong';
With this method you can do the same like this:final Map<Integer, Map<String, String>> arrayMap = MapExtensions.newAssosiativeArrayMap(); arrayMap.get(0).put("firstName", "Albert"); arrayMap.get(0).put("lastName", "Einstein"); arrayMap.get(1).put("firstName", "Neil"); arrayMap.get(1).put("lastName", "Armstrong");- Returns:
- The
Mapthat acts like a javascript associative array
-
newConcurrentHashMap
public static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> newConcurrentHashMap()
Factory method for create a newConcurrentHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
ConcurrentHashMap
-
newConcurrentHashMap
public static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> newConcurrentHashMap(@NonNull @NonNull java.util.Map<K,V> map)Factory method for create a newConcurrentHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
map- the map- Returns:
- The new
ConcurrentHashMap
-
newConcurrentHashMap
public static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> newConcurrentHashMap(int initialCapacity)
Factory method for create a newConcurrentHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
initialCapacity- the initial capacity- Returns:
- The new
ConcurrentHashMap
-
newHashMap
public static <K,V> java.util.Map<K,V> newHashMap(int initialCapacity)
Factory method for create a newHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
initialCapacity- the initial capacity- Returns:
- The new
HashMap
-
newHashMap
public static <K,V> java.util.Map<K,V> newHashMap()
Factory method for create a newHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
HashMap
-
newHashMap
public static <K,V> java.util.Map<K,V> newHashMap(@NonNull @NonNull java.util.Map<K,V> map)Factory method for create a newHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
map- the map- Returns:
- The new
HashMap
-
newHashMap
public static <K,V> java.util.Map<K,V> newHashMap(@NonNull @NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the collection with the key value pairs- Returns:
- The new
HashMap
-
newHashMap
@SafeVarargs public static <K,V> java.util.Map<K,V> newHashMap(@NonNull @NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the key value pairs to add in the newHashMap- Returns:
- The new
HashMap
-
newLinkedHashMap
public static <K,V> java.util.Map<K,V> newLinkedHashMap()
Factory method for create a newLinkedHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
LinkedHashMap
-
newLinkedHashMap
public static <K,V> java.util.Map<K,V> newLinkedHashMap(@NonNull @NonNull java.util.Map<K,V> map)Factory method for create a newLinkedHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
map- the map- Returns:
- The new
LinkedHashMap
-
newLinkedHashMap
public static <K,V> java.util.Map<K,V> newLinkedHashMap(@NonNull @NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newLinkedHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the collection with the key value pairs- Returns:
- The new
LinkedHashMap
-
newLinkedHashMap
@SafeVarargs public static <K,V> java.util.Map<K,V> newLinkedHashMap(@NonNull @NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newLinkedHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the key value pairs to add in the newLinkedHashMap- Returns:
- The new
LinkedHashMap
-
newLinkedHashMap
public static <K,V> java.util.Map<K,V> newLinkedHashMap(int initialCapacity)
Factory method for create a newLinkedHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
initialCapacity- the initial capacity- Returns:
- The new
LinkedHashMap
-
newLazyMap
public static <K,V> java.util.Map<K,V> newLazyMap()
Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
LazyMap
-
newLazyHashMap
public static <K,V> java.util.Map<K,V> newLazyHashMap()
Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
LazyMap
-
newLazyHashMap
public static <K,V> java.util.Map<K,V> newLazyHashMap(java.util.HashMap<K,V> map)
Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aHashMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
map- the map to initialize with it- Returns:
- The new
LazyMap
-
newLazyTreeMap
public static <K,V> java.util.Map<K,V> newLazyTreeMap()
Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
LazyMap
-
newLazyTreeMap
public static <K,V> java.util.Map<K,V> newLazyTreeMap(@NonNull @NonNull java.util.TreeMap<K,V> map)Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
map- the map- Returns:
- The new
LazyMap
-
newLazyTreeMap
public static <K,V> java.util.Map<K,V> newLazyTreeMap(@NonNull @NonNull java.util.Comparator<? super K> comparator)Factory method for create a newLazyMapfrom commons-collections4 that encapsulates aTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
comparator- the comparator- Returns:
- The new
LazyMap
-
newTreeMap
public static <K,V> java.util.Map<K,V> newTreeMap()
Factory method for create a newTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Returns:
- The new
TreeMap
-
newTreeMap
public static <K,V> java.util.Map<K,V> newTreeMap(@NonNull @NonNull java.util.Map<K,V> map)Factory method for create a newTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
map- the map- Returns:
- The new
TreeMap
-
newTreeMap
public static <K,V> java.util.Map<K,V> newTreeMap(@NonNull @NonNull java.util.Comparator<? super K> comparator)Factory method for create a newTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
comparator- the comparator- Returns:
- The new
TreeMap
-
newTreeMap
public static <K,V> java.util.Map<K,V> newTreeMap(@NonNull @NonNull java.util.Comparator<? super K> comparator, @NonNull @NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
comparator- the comparatorkeyValuePairs- the key value pairs- Returns:
- The new
TreeMap
-
newTreeMap
@SafeVarargs public static <K,V> java.util.Map<K,V> newTreeMap(@NonNull @NonNull java.util.Comparator<? super K> comparator, @NonNull @NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
comparator- the comparatorkeyValuePairs- the key value pairs to add in the newTreeMap- Returns:
- The new
TreeMap
-
newTreeMap
public static <K,V> java.util.Map<K,V> newTreeMap(@NonNull @NonNull java.util.Collection<de.alpharogroup.collections.pairs.KeyValuePair<K,V>> keyValuePairs)Factory method for create a newTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the collection with the key value pairs- Returns:
- The new
TreeMap
-
newTreeMap
@SafeVarargs public static <K,V> java.util.Map<K,V> newTreeMap(@NonNull @NonNull de.alpharogroup.collections.pairs.KeyValuePair<K,V>... keyValuePairs)Factory method for create a newTreeMap- Type Parameters:
K- the generic type of the keyV- the generic type of the value- Parameters:
keyValuePairs- the key value pairs to add in the newTreeMap- Returns:
- The new
TreeMap
-
-