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:
    • from

      public static <K, E> ListMultimap<K,E> from(Map<? extends K,? extends E> map)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      map -
      Returns:
    • fromm

      @Beta public static <K, E> ListMultimap<K,E> fromm(Map<? extends K,? extends Collection<? extends E>> map)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      map -
      Returns:
    • from

      public static <T, K, X extends Exception> ListMultimap<K,T> from(Collection<? extends T> c, Throwables.Function<? super T,? extends K,X> keyMapper) throws X
      Type Parameters:
      T -
      K - the key type
      X -
      Parameters:
      c -
      keyMapper -
      Returns:
      Throws:
      X - the x
    • from

      public static <T, K, E, X extends Exception, X2 extends Exception> ListMultimap<K,E> from(Collection<? extends T> c, Throwables.Function<? super T,? extends K,X> keyMapper, Throwables.Function<? super T,? extends E,X2> valueExtractor) throws X, X2
      Type Parameters:
      T -
      K - the key type
      E -
      X -
      X2 -
      Parameters:
      c -
      keyMapper -
      valueExtractor -
      Returns:
      Throws:
      X - the x
      X2 - the x2
    • invertFrom

      public static <K, E> ListMultimap<E,K> invertFrom(Map<K,E> map)
      Type Parameters:
      K - the key type
      E -
      Parameters:
      map -
      Returns:
      See Also:
      • invalid @see
        Multimap#invertFrom(Map, com.landawn.abacus.util.function.Supplier)
    • flatInvertFrom

      public static <K, E> ListMultimap<E,K> flatInvertFrom(Map<K,? extends Collection<? extends E>> map)
      Flat invert from.
      Type Parameters:
      K - the key type
      E -
      Parameters:
      map -
      Returns:
      See Also:
      • invalid @see
        Multimap#flatInvertFrom(Map, com.landawn.abacus.util.function.Supplier)
    • invertFrom

      public static <K, E, V extends Collection<E>> ListMultimap<E,K> invertFrom(Multimap<K,E,V> map)
      Type Parameters:
      K - the key type
      E -
      V - the value type
      Parameters:
      map -
      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:
    • 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:
    • wrapp

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

      @Deprecated public static <K, E, V extends Collection<E>, M extends Multimap<K, E, V>> M from(Map<? extends K,? extends E> map, IntFunction<? extends M> multimapSupplier) throws UnsupportedOperationException
      Deprecated.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      M -
      Parameters:
      map -
      multimapSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • fromm

      @Deprecated public static <K, E, V extends Collection<E>, M extends Multimap<K, E, V>> M fromm(Map<? extends K,? extends Collection<? extends E>> map, IntFunction<? extends M> multimapSupplier) throws UnsupportedOperationException
      Deprecated.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      M -
      Parameters:
      map -
      multimapSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • from

      @Deprecated public static <T, K, V extends Collection<T>, M extends Multimap<K, T, V>, X extends Exception> M from(Collection<? extends T> c, Throwables.Function<? super T,? extends K,X> keyMapper, IntFunction<? extends M> multimapSupplier) throws X
      Deprecated.
      Type Parameters:
      T -
      K - the key type
      V - the value type
      M -
      X -
      Parameters:
      c -
      keyMapper -
      multimapSupplier -
      Returns:
      Throws:
      X - the x
    • from

      @Deprecated public static <T, K, E, V extends Collection<E>, M extends Multimap<K, E, V>, X extends Exception, X2 extends Exception> M from(Collection<? extends T> c, Throwables.Function<? super T,? extends K,X> keyMapper, Throwables.Function<? super T,? extends E,X2> valueExtractor, IntFunction<? extends M> multimapSupplier) throws X, X2
      Deprecated.
      Type Parameters:
      T -
      K - the key type
      E -
      V - the value type
      M -
      X -
      X2 -
      Parameters:
      c -
      keyMapper -
      valueExtractor -
      multimapSupplier -
      Returns:
      Throws:
      X - the x
      X2 - the x2
    • invertFrom

      @Deprecated public static <K, E, V extends Collection<K>, M extends Multimap<E, K, V>> M invertFrom(Map<K,E> map, IntFunction<? extends M> multimapSupplier) throws UnsupportedOperationException
      Deprecated.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      M -
      Parameters:
      map -
      multimapSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • flatInvertFrom

      @Deprecated public static <K, E, V extends Collection<K>, M extends Multimap<E, K, V>> M flatInvertFrom(Map<K,? extends Collection<? extends E>> map, IntFunction<? extends M> multimapSupplier) throws UnsupportedOperationException
      Deprecated.
      Flat invert from.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      M -
      Parameters:
      map -
      multimapSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • invertFrom

      @Deprecated public static <K, E, V extends Collection<E>, VV extends Collection<K>, M extends Multimap<E, K, VV>> M invertFrom(Multimap<K,E,V> multimap, IntFunction<? extends M> multimapSupplier) throws UnsupportedOperationException
      Deprecated.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      VV -
      M -
      Parameters:
      multimap -
      multimapSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • concat

      @Deprecated public static <K, E, V extends Collection<E>, M extends Multimap<K, E, V>> M concat(Map<? extends K,? extends E> a, Map<? extends K,? extends E> b, IntFunction<? extends M> multimapSupplier) throws UnsupportedOperationException
      Deprecated.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      M -
      Parameters:
      a -
      b -
      multimapSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • concat

      @Deprecated public static <K, E, V extends Collection<E>, M extends Multimap<K, E, V>> M concat(Map<? extends K,? extends E> a, Map<? extends K,? extends E> b, Map<? extends K,? extends E> c, IntFunction<? extends M> multimapSupplier) throws UnsupportedOperationException
      Deprecated.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      M -
      Parameters:
      a -
      b -
      c -
      multimapSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • wrap

      @Deprecated public static <K, E, V extends Collection<E>> Multimap<K,E,V> wrap(Map<K,V> map, Supplier<? extends V> valueSupplier) throws UnsupportedOperationException
      Deprecated.
      Type Parameters:
      K - the key type
      E -
      V - the value type
      Parameters:
      map -
      valueSupplier -
      Returns:
      Throws:
      UnsupportedOperationException
    • 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
    • copy

      public ListMultimap<K,E> copy()
      Overrides:
      copy in class Multimap<K,E,List<E>>
    • 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: