guava/src/com/google/common/collect/ImmutableListMultimap.java
public static <T, K, V> Collector<T, ?, ImmutableListMultimap<K, V>> toImmutableListMultimap(
      Function<? super T, ? extends K> keyFunction,
      Function<? super T, ? extends V> valueFunction) {
    checkNotNull(keyFunction, "keyFunction");
    checkNotNull(valueFunction, "valueFunction");
    return Collector.of(
        ImmutableListMultimap::<K, V>builder,
        (builder, t) -> builder.put(keyFunction.apply(t), valueFunction.apply(t)),
        ImmutableListMultimap.Builder::combine,
        ImmutableListMultimap.Builder::build);
  }
public static <T, K, V> Collector<T, ?, ImmutableListMultimap<K, V>> toImmutableListMultimap(
      Function<? super T, ? extends K> keyFunction,
      Function<? super T, ? extends V> valueFunction) {
    checkNotNull(keyFunction, "keyFunction");
    checkNotNull(valueFunction, "valueFunction");
    return Collector.of(
        ImmutableListMultimap::<K, V>builder,
        (builder, t) -> builder.put(keyFunction.apply(t), valueFunction.apply(t)),
        ImmutableListMultimap.Builder::combine,
        ImmutableListMultimap.Builder::build);
  }
Returns a {@link Collector} that accumulates elements into an {@code ImmutableListMultimap}
whose keys and values are the result of applying the provided mapping functions to the input
elements.

<p>For streams with {@linkplain java.util.stream#Ordering defined encounter order}, that order
is preserved, but entries are <a href="ImmutableMultimap.html#iteration">grouped by key</a>.

<p>Example:

<pre>{@code
static final Multimap<Character, String> FIRST_LETTER_MULTIMAP =
Stream.of("banana", "apple", "carrot", "asparagus", "cherry")
.collect(toImmutableListMultimap(str -> str.charAt(0), str -> str.substring(1)));

// is equivalent to

static final Multimap<Character, String> FIRST_LETTER_MULTIMAP =
new ImmutableListMultimap.Builder<Character, String>()
.put('b', "anana")
.putAll('a', "pple", "sparagus")
.putAll('c', "arrot", "herry")
.build();
}</pre>

@since 21.0