code: public static <T, K, V>
        Collector<T, ?, ImmutableListMultimap<K, V>> flatteningToImmutableListMultimap(
            Function<? super T, ? extends K> keyFunction,
            Function<? super T, ? extends Stream<? extends V>> valuesFunction) {
      checkNotNull(keyFunction);
      checkNotNull(valuesFunction);
      return Collectors.collectingAndThen(
          Multimaps.flatteningToMultimap(
              input -> checkNotNull(keyFunction.apply(input)),
              input -> valuesFunction.apply(input).peek(Preconditions::checkNotNull),
              MultimapBuilder.linkedHashKeys().arrayListValues()::<K, V>build),
          ImmutableListMultimap::copyOf);
    }
docs: Returns a {@code Collector} accumulating entries into an {@code ImmutableListMultimap}. Each
  input element is mapped to a key and a stream of values, each of which are put into the
  resulting {@code Multimap}, in the encounter order of the stream and the encounter order of the
  streams of values.
  
  <p>Example:
  
  <pre>{@code
  static final ImmutableListMultimap<Character, Character> FIRST_LETTER_MULTIMAP =
  Stream.of("banana", "apple", "carrot", "asparagus", "cherry")
  .collect(
  flatteningToImmutableListMultimap(
  str -> str.charAt(0),
  str -> str.substring(1).chars().mapToObj(c -> (char) c));
  
  // is equivalent to
  
  static final ImmutableListMultimap<Character, Character> FIRST_LETTER_MULTIMAP =
  ImmutableListMultimap.<Character, Character>builder()
  .putAll('b', Arrays.asList('a', 'n', 'a', 'n', 'a'))
  .putAll('a', Arrays.asList('p', 'p', 'l', 'e'))
  .putAll('c', Arrays.asList('a', 'r', 'r', 'o', 't'))
  .putAll('a', Arrays.asList('s', 'p', 'a', 'r', 'a', 'g', 'u', 's'))
  .putAll('c', Arrays.asList('h', 'e', 'r', 'r', 'y'))
  .build();
  }
  }</pre>
  
  @since 21.0