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 newConcurrentHashMap
containing a single mapping.static <K,
V> ConcurrentHashMap <K, V> of
(K k1, V v1, K k2, V v2) Returns a newConcurrentHashMap
containing two mappings.static <K,
V> ConcurrentHashMap <K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3) Returns a newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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 newConcurrentHashMap
containing 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
ConcurrentHashMap
containing the specified mapping - Throws:
NullPointerException
- if the key or the value isnull
-
of
Returns a newConcurrentHashMap
containing two mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing the specified mappings
-
of
Returns a newConcurrentHashMap
containing three mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing the specified mappings
-
of
Returns a newConcurrentHashMap
containing four mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing 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 newConcurrentHashMap
containing five mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing 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 newConcurrentHashMap
containing six mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing 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 newConcurrentHashMap
containing seven mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing 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 newConcurrentHashMap
containing eight mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing 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 newConcurrentHashMap
containing nine mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing 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 newConcurrentHashMap
containing ten mappings. This method leveragesjava.util.Map.of
for 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
ConcurrentHashMap
containing the specified mappings
-