Class Pairs

java.lang.Object
com.google.adk.utils.Pairs

public final class Pairs extends Object
Utility class for creating ConcurrentHashMaps.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K,V> ConcurrentHashMap<K,V>
    of()
    Returns a new, empty ConcurrentHashMap.
    static <K,V> ConcurrentHashMap<K,V>
    of(K k1, V v1)
    Returns a new ConcurrentHashMap containing a single mapping.
    static <K,V> ConcurrentHashMap<K,V>
    of(K k1, V v1, K k2, V v2)
    Returns a new ConcurrentHashMap containing two mappings.
    static <K,V> ConcurrentHashMap<K,V>
    of(K k1, V v1, K k2, V v2, K k3, V v3)
    Returns a new ConcurrentHashMap 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 new ConcurrentHashMap 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 new ConcurrentHashMap 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 new ConcurrentHashMap 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 new ConcurrentHashMap 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 new ConcurrentHashMap 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 new ConcurrentHashMap 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 new ConcurrentHashMap containing ten mappings.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static <K,V> ConcurrentHashMap<K,V> of()
      Returns a new, empty ConcurrentHashMap.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Returns:
      an empty ConcurrentHashMap
    • of

      public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1)
      Returns a new ConcurrentHashMap containing a single mapping.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the mapping's key
      v1 - the mapping's value
      Returns:
      a ConcurrentHashMap containing the specified mapping
      Throws:
      NullPointerException - if the key or the value is null
    • of

      public static <K,V> ConcurrentHashMap<K,V> of(K k1, V v1, K k2, V v2)
      Returns a new ConcurrentHashMap containing two mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second 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)
      Returns a new ConcurrentHashMap containing three mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third 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)
      Returns a new ConcurrentHashMap containing four mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - 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 new ConcurrentHashMap containing five mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - 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 new ConcurrentHashMap containing six mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - 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 is null (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 new ConcurrentHashMap containing seven mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - 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 new ConcurrentHashMap containing eight mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - the seventh mapping's value
      k8 - the eighth mapping's key
      v8 - 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 new ConcurrentHashMap containing nine mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - the seventh mapping's value
      k8 - the eighth mapping's key
      v8 - the eighth mapping's value
      k9 - the ninth mapping's key
      v9 - 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 new ConcurrentHashMap containing ten mappings. This method leverages java.util.Map.of for initial validation.
      Type Parameters:
      K - the ConcurrentHashMap's key type
      V - the ConcurrentHashMap's value type
      Parameters:
      k1 - the first mapping's key
      v1 - the first mapping's value
      k2 - the second mapping's key
      v2 - the second mapping's value
      k3 - the third mapping's key
      v3 - the third mapping's value
      k4 - the fourth mapping's key
      v4 - the fourth mapping's value
      k5 - the fifth mapping's key
      v5 - the fifth mapping's value
      k6 - the sixth mapping's key
      v6 - the sixth mapping's value
      k7 - the seventh mapping's key
      v7 - the seventh mapping's value
      k8 - the eighth mapping's key
      v8 - the eighth mapping's value
      k9 - the ninth mapping's key
      v9 - the ninth mapping's value
      k10 - the tenth mapping's key
      v10 - the tenth mapping's value
      Returns:
      a ConcurrentHashMap containing the specified mappings