Class ListMultimap<K,E>

java.lang.Object
com.landawn.abacus.util.Multimap<K,E,List<E>>
com.landawn.abacus.util.ListMultimap<K,E>
Type Parameters:
K - the key type
E -

public final class ListMultimap<K,E> extends Multimap<K,E,List<E>>
Since:
0.9
Author:
Haiyang Li
See Also:
  • CommonUtil.newListMultimap()
  • CommonUtil.newListMultimap(Class, Class)
  • CommonUtil.newListMultimap(Supplier, Supplier)
  • Method Details

    • of

      public static <K, E> ListMultimap<K,E> of(K k1, E v1)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      k1 -
      v1 -
      Returns:
    • of

      public static <K, E> ListMultimap<K,E> of(K k1, E v1, K k2, E v2)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      Returns:
    • of

      public static <K, E> ListMultimap<K,E> of(K k1, E v1, K k2, E v2, K k3, E v3)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      Returns:
    • of

      public static <K, E> ListMultimap<K,E> of(K k1, E v1, K k2, E v2, K k3, E v3, K k4, E v4)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      Returns:
    • of

      public static <K, E> ListMultimap<K,E> of(K k1, E v1, K k2, E v2, K k3, E v3, K k4, E v4, K k5, E v5)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      k5 -
      v5 -
      Returns:
    • of

      public static <K, E> ListMultimap<K,E> of(K k1, E v1, K k2, E v2, K k3, E v3, K k4, E v4, K k5, E v5, K k6, E v6)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      k5 -
      v5 -
      k6 -
      v6 -
      Returns:
    • of

      public static <K, E> ListMultimap<K,E> of(K k1, E v1, K k2, E v2, K k3, E v3, K k4, E v4, K k5, E v5, K k6, E v6, K k7, E v7)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      k5 -
      v5 -
      k6 -
      v6 -
      k7 -
      v7 -
      Returns:
    • create

      public static <K, E> ListMultimap<K,E> create(Map<? extends K,? extends E> map)
      Create a new ListMultimap with the keys/values from the specified map.
      Type Parameters:
      K - the key type
      E -
      Parameters:
      map -
      Returns:
    • create

      public static <T, K> ListMultimap<K,T> create(Collection<? extends T> c, Function<? super T,? extends K> keyMapper)
      Type Parameters:
      T -
      K - the key type
      Parameters:
      c -
      keyMapper -
      Returns:
    • create

      public static <T, K, E> ListMultimap<K,E> create(Collection<? extends T> c, Function<? super T,? extends K> keyMapper, Function<? super T,? extends E> valueExtractor)
      Type Parameters:
      T -
      K - the key type
      E -
      Parameters:
      c -
      keyMapper -
      valueExtractor -
      Returns:
    • concat

      public static <K, E> ListMultimap<K,E> concat(Map<? extends K,? extends E> a, Map<? extends K,? extends E> b)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      a -
      b -
      Returns:
    • concat

      public static <K, E> ListMultimap<K,E> concat(Map<? extends K,? extends E> a, Map<? extends K,? extends E> b, Map<? extends K,? extends E> c)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      a -
      b -
      c -
      Returns:
    • concat

      public static <K, E> ListMultimap<K,E> concat(Collection<? extends Map<? extends K,? extends E>> c)
      Type Parameters:
      K -
      E -
      Parameters:
      c -
      Returns:
    • wrap

      public static <K, E, V extends List<E>> ListMultimap<K,E> wrap(Map<K,V> map)
      Type Parameters:
      K - the key type
      E -
      V - the value type
      Parameters:
      map -
      Returns:
    • wrap

      public static <K, E, V extends List<E>> ListMultimap<K,E> wrap(Map<K,V> map, Supplier<? extends V> valueSupplier)
      Type Parameters:
      K - the key type
      E -
      V - the value type
      Parameters:
      map -
      valueSupplier -
      Returns:
    • filterByKey

      public <X extends Exception> ListMultimap<K,E> filterByKey(Throwables.Predicate<? super K,X> filter) throws X
      Filter by key.
      Overrides:
      filterByKey in class Multimap<K,E,List<E>>
      Type Parameters:
      X -
      Parameters:
      filter -
      Returns:
      Throws:
      X - the x
    • filterByValue

      public <X extends Exception> ListMultimap<K,E> filterByValue(Throwables.Predicate<? super List<E>,X> filter) throws X
      Filter by value.
      Overrides:
      filterByValue in class Multimap<K,E,List<E>>
      Type Parameters:
      X -
      Parameters:
      filter -
      Returns:
      Throws:
      X - the x
    • filter

      public <X extends Exception> ListMultimap<K,E> filter(Throwables.BiPredicate<? super K,? super List<E>,X> filter) throws X
      Overrides:
      filter in class Multimap<K,E,List<E>>
      Type Parameters:
      X -
      Parameters:
      filter -
      Returns:
      Throws:
      X - the x
    • inverse

      public ListMultimap<E,K> inverse()
      Returns:
    • copy

      public ListMultimap<K,E> copy()
      Overrides:
      copy in class Multimap<K,E,List<E>>
      Returns:
    • toImmutableMap

      public ImmutableMap<K,ImmutableList<E>> toImmutableMap()
      To immutable map.
      Returns:
    • toImmutableMap

      public ImmutableMap<K,ImmutableList<E>> toImmutableMap(IntFunction<? extends Map<K,ImmutableList<E>>> mapSupplier)
      To immutable map.
      Parameters:
      mapSupplier -
      Returns: