Class Pairs
java.lang.Object
com.google.adk.utils.Pairs
Utility class for creating ConcurrentHashMaps.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> ConcurrentHashMap <K, V> of()Returns a new, emptyConcurrentHashMap.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1) Returns a newConcurrentHashMapcontaining a single mapping.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2) Returns a newConcurrentHashMapcontaining two mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3) Returns a newConcurrentHashMapcontaining three mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns a newConcurrentHashMapcontaining four mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a newConcurrentHashMapcontaining five mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a newConcurrentHashMapcontaining six mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a newConcurrentHashMapcontaining seven mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Returns a newConcurrentHashMapcontaining eight mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Returns a newConcurrentHashMapcontaining nine mappings.static <K,V> ConcurrentHashMap <K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Returns a newConcurrentHashMapcontaining ten mappings.
-
Method Details
-
of
Returns a new, emptyConcurrentHashMap.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Returns:
- an empty
ConcurrentHashMap
-
of
Returns a newConcurrentHashMapcontaining a single mapping.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the mapping's keyv1- the mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mapping - Throws:
NullPointerException- if the key or the value isnull
-
of
Returns a newConcurrentHashMapcontaining two mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-
of
Returns a newConcurrentHashMapcontaining three mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-
of
Returns a newConcurrentHashMapcontaining four mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-
of
public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns a newConcurrentHashMapcontaining five mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-
of
public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns a newConcurrentHashMapcontaining six mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings - Throws:
IllegalArgumentException- if there are any duplicate keys (behavior inherited from Map.of)NullPointerException- if any key or value isnull(behavior inherited from Map.of)
-
of
public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns a newConcurrentHashMapcontaining seven mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-
of
public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Returns a newConcurrentHashMapcontaining eight mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's valuek8- the eighth mapping's keyv8- the eighth mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-
of
public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Returns a newConcurrentHashMapcontaining nine mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's valuek8- the eighth mapping's keyv8- the eighth mapping's valuek9- the ninth mapping's keyv9- the ninth mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-
of
public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Returns a newConcurrentHashMapcontaining ten mappings. This method leveragesjava.util.Map.offor initial validation.- Type Parameters:
K- theConcurrentHashMap's key typeV- theConcurrentHashMap's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's valuek8- the eighth mapping's keyv8- the eighth mapping's valuek9- the ninth mapping's keyv9- the ninth mapping's valuek10- the tenth mapping's keyv10- the tenth mapping's value- Returns:
- a
ConcurrentHashMapcontaining the specified mappings
-