Module id.xfunction

Class ImmutableMultiMap<K,V>

Object
ImmutableMultiMap<K,V>
All Implemented Interfaces:
Iterable<Map.Entry<K,List<V>>>

public class ImmutableMultiMap<K,V> extends Object implements Iterable<Map.Entry<K,List<V>>>
Map where each key may have multiple values assigned to it. All pairs are insertion-ordered.

Factory methods support multiple entries with same values, example:


 ImmutableMultiMap.of(1, "a", 2, "b", 1, "c")
 
  • Constructor Details

  • Method Details

    • of

      public static <K1, V1> ImmutableMultiMap<K1,V1> of()
    • of

      public static <K, V> ImmutableMultiMap<K,V> of(K k1, V v1)
    • of

      public static <K, V> ImmutableMultiMap<K,V> of(K k1, V v1, K k2, V v2)
    • of

      public static <K, V> ImmutableMultiMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3)
    • of

      public static <K, V> ImmutableMultiMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
    • of

      public static <K, V> ImmutableMultiMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
    • of

      public static <K, V> ImmutableMultiMap<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)
    • of

      public static <K, V> ImmutableMultiMap<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)
    • of

      public static <K, V> ImmutableMultiMap<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)
    • of

      public static <K, V> ImmutableMultiMap<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)
    • get

      public List<V> get(K key)
    • containsKey

      public boolean containsKey(K key)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toJsonString

      public String toJsonString()
    • getFirstParameter

      public Optional<V> getFirstParameter(K key)
    • isEmpty

      public boolean isEmpty()
    • toMap

      public Map<K,V> toMap()
      Returns:
      single value map with only first value included
    • values

      public Stream<V> values()
    • stream

      public Stream<Map.Entry<K,List<V>>> stream()
    • iterator

      public Iterator<Map.Entry<K,List<V>>> iterator()
      Read only iterator
      Specified by:
      iterator in interface Iterable<K>