Class MapEntries

java.lang.Object
org.jhotdraw8.icollection.MapEntries

public class MapEntries extends Object
Provides factory methods for creating a list of Map.Entrys.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K, V> @NonNull Map.Entry<K,V>
    entry(K k, V v)
    Creates a new map entry.
    static <K, V> LinkedHashMap<K,V>
    linkedHashMap(@NonNull List<? extends Map.Entry<? extends K,? extends V>> l)
    Creates a new linked hash map from a list of entries.
    static <K, V, M extends Map<K, V>>
    M
    map(@NonNull Supplier<M> factory, @NonNull List<? extends Map.Entry<? extends K,? extends V>> l)
    Creates a new map from a list of entries.
    static <K, V> @NonNull List<Map.Entry<K,V>>
    of()
    Returns a list containing 0 map entries.
    static <K, V> @NonNull List<Map.Entry<K,V>>
    of(K k1, V v1)
    Returns a list containing 1 map entry.
    static <K, V> @NonNull List<Map.Entry<K,V>>
    of(K k1, V v1, K k2, V v2)
    Returns a list containing 2 map entries.
    static <K, V> @NonNull List<Map.Entry<K,V>>
    of(K k1, V v1, K k2, V v2, K k3, V v3)
    Returns a list containing 3 map entries.
    static <K, V> @NonNull List<Map.Entry<K,V>>
    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
    Returns a list containing 4 map entries.
    static <K, V> @NonNull List<Map.Entry<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 list containing 5 map entries.
    static <K, V> @NonNull List<Map.Entry<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 list containing 6 map entries.
    static <K, V> @NonNull List<Map.Entry<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 list containing 7 map entries.
    static <K, V> @NonNull List<Map.Entry<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 list containing 8 map entries.
    static <K, V> @NonNull List<Map.Entry<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 list containing 9 map entries.
    static <K, V> @NonNull List<Map.Entry<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 list containing 10 map entries.
    static <K, V> @NonNull List<Map.Entry<K,V>>
    ofEntries(Map.Entry<? extends K,? extends V>... entries)
    Returns a list containing the specified map entries.

    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> @NonNull List<Map.Entry<K,V>> of()
      Returns a list containing 0 map entries.

      Keys and values can be null.

      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<K,V>> of(K k1, V v1)
      Returns a list containing 1 map entry.

      Key and value can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<K,V>> of(K k1, V v1, K k2, V v2)
      Returns a list containing 2 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<K,V>> of(K k1, V v1, K k2, V v2, K k3, V v3)
      Returns a list containing 3 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<K,V>> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
      Returns a list containing 4 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      k4 - key 4
      v4 - value 4
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<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 list containing 5 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      k4 - key 4
      v4 - value 4
      k5 - key 5
      v5 - value 5
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<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 list containing 6 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      k4 - key 4
      v4 - value 4
      k5 - key 5
      v5 - value 5
      k6 - key 6
      v6 - value 6
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<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 list containing 7 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      k4 - key 4
      v4 - value 4
      k5 - key 5
      v5 - value 5
      k6 - key 6
      v6 - value 6
      k7 - key 7
      v7 - value 7
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<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 list containing 8 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      k4 - key 4
      v4 - value 4
      k5 - key 5
      v5 - value 5
      k6 - key 6
      v6 - value 6
      k7 - key 7
      v7 - value 7
      k8 - key 8
      v8 - value 8
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<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 list containing 9 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      k4 - key 4
      v4 - value 4
      k5 - key 5
      v5 - value 5
      k6 - key 6
      v6 - value 6
      k7 - key 7
      v7 - value 7
      k8 - key 8
      v8 - value 8
      k9 - key 9
      v9 - value 9
      Returns:
      a list containing the entries
    • of

      public static <K, V> @NonNull List<Map.Entry<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 list containing 10 map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 - key 1
      v1 - value 1
      k2 - key 2
      v2 - value 2
      k3 - key 3
      v3 - value 3
      k4 - key 4
      v4 - value 4
      k5 - key 5
      v5 - value 5
      k6 - key 6
      v6 - value 6
      k7 - key 7
      v7 - value 7
      k8 - key 8
      v8 - value 8
      k9 - key 9
      v9 - value 9
      k10 - key 10
      v10 - value 10
      Returns:
      a list containing the entries
    • ofEntries

      @SafeVarargs public static <K, V> @NonNull List<Map.Entry<K,V>> ofEntries(Map.Entry<? extends K,? extends V>... entries)
      Returns a list containing the specified map entries.

      Keys and values can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      entries - the entries
      Returns:
      a list containing the entries
    • linkedHashMap

      public static <K, V> LinkedHashMap<K,V> linkedHashMap(@NonNull List<? extends Map.Entry<? extends K,? extends V>> l)
      Creates a new linked hash map from a list of entries.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      l - a list of entries
      Returns:
      a new linked hash map
    • map

      public static <K, V, M extends Map<K, V>> M map(@NonNull Supplier<M> factory, @NonNull List<? extends Map.Entry<? extends K,? extends V>> l)
      Creates a new map from a list of entries.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      l - a list of entries
      Returns:
      a new linked hash map
    • entry

      public static <K, V> @NonNull Map.Entry<K,V> entry(K k, V v)
      Creates a new map entry.

      Key and value can be null.

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k - the key
      v - the value
      Returns:
      a new map entry