static <K, V> ImmutableListMultimap<K, V> fromMapEntries(
      Collection<? extends Map.Entry<? extends K, ? extends Collection<? extends V>>> mapEntries,
      @NullableDecl Comparator<? super V> valueComparator) {
    if (mapEntries.isEmpty()) {
      return of();
    }
    ImmutableMap.Builder<K, ImmutableList<V>> builder =
        new ImmutableMap.Builder<>(mapEntries.size());
    int size = 0;

    for (Entry<? extends K, ? extends Collection<? extends V>> entry : mapEntries) {
      K key = entry.getKey();
      Collection<? extends V> values = entry.getValue();
      ImmutableList<V> list =
          (valueComparator == null)
              ? ImmutableList.copyOf(values)
              : ImmutableList.sortedCopyOf(valueComparator, values);
      if (!list.isEmpty()) {
        builder.put(key, list);
        size += list.size();
      }
    }

    return new ImmutableListMultimap<>(builder.build(), size);
  }
static <K, V> ImmutableListMultimap<K, V> fromMapEntries(
      Collection<? extends Map.Entry<? extends K, ? extends Collection<? extends V>>> mapEntries,
      @NullableDecl Comparator<? super V> valueComparator) {
    if (mapEntries.isEmpty()) {
      return of();
    }
    ImmutableMap.Builder<K, ImmutableList<V>> builder =
        new ImmutableMap.Builder<>(mapEntries.size());
    int size = 0;

    for (Entry<? extends K, ? extends Collection<? extends V>> entry : mapEntries) {
      K key = entry.getKey();
      Collection<? extends V> values = entry.getValue();
      ImmutableList<V> list =
          (valueComparator == null)
              ? ImmutableList.copyOf(values)
              : ImmutableList.sortedCopyOf(valueComparator, values);
      if (!list.isEmpty()) {
        builder.put(key, list);
        size += list.size();
      }
    }

    return new ImmutableListMultimap<>(builder.build(), size);
  }
static < K , V > ImmutableListMultimap < K , V > fromMapEntries ( Collection < ? extends Map . Entry < ? extends K , ? extends Collection < ? extends V > > > mapEntries , @ NullableDecl Comparator < ? super V > valueComparator ) { if ( mapEntries . isEmpty ( ) ) { return of ( ) ; } ImmutableMap . Builder < K , ImmutableList < V > > builder = new ImmutableMap . Builder <> ( mapEntries . size ( ) ) ; int size = 0 ; for ( Entry < ? extends K , ? extends Collection < ? extends V > > entry : mapEntries ) { K key = entry . getKey ( ) ; Collection < ? extends V > values = entry . getValue ( ) ; ImmutableList < V > list = ( valueComparator == null ) ? ImmutableList . copyOf ( values ) : ImmutableList . sortedCopyOf ( valueComparator , values ) ; if ( ! list . isEmpty ( ) ) { builder . put ( key , list ) ; size += list . size ( ) ; } } return new ImmutableListMultimap <> ( builder . build ( ) , size ) ; }
Creates an ImmutableListMultimap from an asMap.entrySet.
Creates an ImmutableListMultimap from an asMap . entrySet .