reactor-core/src/main/java/reactor/core/publisher/Flux.java
public final <K, V> Mono<Map<K, Collection<V>>> collectMultimap(
			final Function<? super T, ? extends K> keyExtractor,
			final Function<? super T, ? extends V> valueExtractor,
			Supplier<Map<K, Collection<V>>> mapSupplier) {
		Objects.requireNonNull(keyExtractor, "Key extractor is null");
		Objects.requireNonNull(valueExtractor, "Value extractor is null");
		Objects.requireNonNull(mapSupplier, "Map supplier is null");
		return collect(mapSupplier, (m, d) -> {
			K key = keyExtractor.apply(d);
			Collection<V> values = m.computeIfAbsent(key, k -> new ArrayList<>());
			values.add(valueExtractor.apply(d));
		});
	}
public final <K, V> Mono<Map<K, Collection<V>>> collectMultimap(
			final Function<? super T, ? extends K> keyExtractor,
			final Function<? super T, ? extends V> valueExtractor,
			Supplier<Map<K, Collection<V>>> mapSupplier) {
		Objects.requireNonNull(keyExtractor, "Key extractor is null");
		Objects.requireNonNull(valueExtractor, "Value extractor is null");
		Objects.requireNonNull(mapSupplier, "Map supplier is null");
		return collect(mapSupplier, (m, d) -> {
			K key = keyExtractor.apply(d);
			Collection<V> values = m.computeIfAbsent(key, k -> new ArrayList<>());
			values.add(valueExtractor.apply(d));
		});
	}
public final < K , V > Mono < Map < K , Collection < V > > > collectMultimap ( final Function < ? super T , ? extends K > keyExtractor , final Function < ? super T , ? extends V > valueExtractor , Supplier < Map < K , Collection < V > > > mapSupplier ) { Objects . requireNonNull ( keyExtractor , "Key extractor is null" ) ; Objects . requireNonNull ( valueExtractor , "Value extractor is null" ) ; Objects . requireNonNull ( mapSupplier , "Map supplier is null" ) ; return collect ( mapSupplier , ( m , d ) -> { K key = keyExtractor . apply ( d ) ; Collection < V > values = m . computeIfAbsent ( key , k -> new ArrayList <> ( ) ) ; values . add ( valueExtractor . apply ( d ) ) ; } ) ; }
Collect all elements emitted by this {@link Flux} into a user-defined {@link Map multimap} that is
emitted by the resulting {@link Mono} when this sequence completes.
The key is extracted from each element by applying the {@code keyExtractor}
{@link Function}, and every element mapping to the same key is converted by the
{@code valueExtractor} Function to a value stored in the {@link Collection} associated to
said key.

<p>
<img class="marble" src="doc-files/marbles/collectMultiMapWithKeyAndValueExtractors.svg" alt="">

@reactor.discard This operator discards the buffer upon cancellation or error triggered by a data signal.

@param keyExtractor a {@link Function} to map elements to a key for the {@link Map}
@param valueExtractor a {@link Function} to map elements to a value for the {@link Map}
@param mapSupplier a multimap ({@link Map} of {@link Collection}) factory called
for each {@link Subscriber}

@param <K> the type of the key extracted from each source element
@param <V> the type of the value extracted from each source element

@return a {@link Mono} of a {@link Map} of key-Collection(values) pairs
Collect all elements emitted by this { @link Flux } into a user - defined { @link Map multimap } that is emitted by the resulting { @link Mono } when this sequence completes . The key is extracted from each element by applying the { @code keyExtractor } { @link Function } and every element mapping to the same key is converted by the { @code valueExtractor } Function to a value stored in the { @link Collection } associated to said key .