Callable<Map<K, Collection<V>>> mapSupplier ) { return toMultimap(keySelector, valueSelector, mapSupplier, ArrayListSupplier.<V, K>asFunction());
Callable<Map<K, Collection<V>>> mapSupplier ) { return toMultimap(keySelector, valueSelector, mapSupplier, ArrayListSupplier.<V, K>asFunction());
/** * Returns a Single that emits a single HashMap that contains an ArrayList of values extracted by a * specified {@code valueSelector} function from items emitted by the source ObservableSource, keyed by a * specified {@code keySelector} function. * <p> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toMultiMap.2.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMultimap} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <K> the key type of the Map * @param <V> the value type of the Map * @param keySelector * the function that extracts a key from the source items to be used as key in the HashMap * @param valueSelector * the function that extracts a value from the source items to be used as value in the HashMap * @return a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from * the source ObservableSource * @see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <K, V> Single<Map<K, Collection<V>>> toMultimap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector) { Callable<Map<K, Collection<V>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<V>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); }
/** * Returns a Single that emits a single HashMap that contains an ArrayList of values extracted by a * specified {@code valueSelector} function from items emitted by the source ObservableSource, keyed by a * specified {@code keySelector} function. * <p> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toMultiMap.2.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMultimap} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <K> the key type of the Map * @param <V> the value type of the Map * @param keySelector * the function that extracts a key from the source items to be used as key in the HashMap * @param valueSelector * the function that extracts a value from the source items to be used as value in the HashMap * @return a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from * the source ObservableSource * @see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <K, V> Single<Map<K, Collection<V>>> toMultimap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector) { Callable<Map<K, Collection<V>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<V>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); }
Callable<Map<K, Collection<V>>> mapSupplier ) { return toMultimap(keySelector, valueSelector, mapSupplier, ArrayListSupplier.<V, K>asFunction());
Callable<Map<K, Collection<V>>> mapSupplier ) { return toMultimap(source, keySelector, valueSelector, mapSupplier, ArrayListSupplier.<V, K>asFunction());
/** * Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the * source ObservableSource keyed by a specified {@code keySelector} function. * <p> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toMultiMap.2.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMultimap} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <K> the key type of the Map * @param keySelector * the function that extracts the key from the source items to be used as key in the HashMap * @return a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from * the source ObservableSource * @see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <K> Single<Map<K, Collection<T>>> toMultimap(Function<? super T, ? extends K> keySelector) { @SuppressWarnings({ "rawtypes", "unchecked" }) Function<? super T, ? extends T> valueSelector = (Function)Functions.identity(); Callable<Map<K, Collection<T>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<T>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); }
/** * Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the * source ObservableSource keyed by a specified {@code keySelector} function. * <p> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toMultiMap.2.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMultimap} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <K> the key type of the Map * @param keySelector * the function that extracts the key from the source items to be used as key in the HashMap * @return a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from * the source ObservableSource * @see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a> */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <K> Single<Map<K, Collection<T>>> toMultimap(Function<? super T, ? extends K> keySelector) { @SuppressWarnings({ "rawtypes", "unchecked" }) Function<? super T, ? extends T> valueSelector = (Function)Functions.identity(); Callable<Map<K, Collection<T>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<T>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); }
public final <K, V> Flowable<Map<K, Collection<V>>> toMultimap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector) { Callable<Map<K, Collection<V>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<V>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory);
public static <T, K, V> Single<Map<K, Collection<V>>> toMultimap(Flowable<T> source, Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector) { Callable<Map<K, Collection<V>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<V>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(source, keySelector, valueSelector, mapSupplier, collectionFactory);
/** * Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the * source Publisher keyed by a specified {@code keySelector} function. * <p> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toMultiMap.png" alt=""> * <dl> * <dt><b>Backpressure:</b></dt> * <dd>This operator does not support backpressure as by intent it is requesting and buffering everything.</dd> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMultimap} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <K> the key type of the Map * @param keySelector * the function that extracts the key from the source items to be used as key in the HashMap * @return a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from * the source Publisher * @see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a> */ @CheckReturnValue @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) public final <K> Flowable<Map<K, Collection<T>>> toMultimap(Function<? super T, ? extends K> keySelector) { Function<T, T> valueSelector = Functions.identity(); Callable<Map<K, Collection<T>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<T>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(keySelector, valueSelector, mapSupplier, collectionFactory); }
/** * Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the * source Publisher keyed by a specified {@code keySelector} function. * <p> * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toMultiMap.png" alt=""> * <dl> * <dt><b>Backpressure:</b></dt> * <dd>This operator does not support backpressure as by intent it is requesting and buffering everything.</dd> * <dt><b>Scheduler:</b></dt> * <dd>{@code toMultimap} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <K> the key type of the Map * @param <T> the source value type * @param source the source Flowable instance * @param keySelector * the function that extracts the key from the source items to be used as key in the HashMap * @return a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from * the source Publisher * @see <a href="http://reactivex.io/documentation/operators/to.html">ReactiveX operators documentation: To</a> */ @CheckReturnValue @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @SchedulerSupport(SchedulerSupport.NONE) public static <T, K> Single<Map<K, Collection<T>>> toMultimap(Flowable<T> source, Function<? super T, ? extends K> keySelector) { Function<T, T> valueSelector = Functions.identity(); Callable<Map<K, Collection<T>>> mapSupplier = HashMapSupplier.asCallable(); Function<K, List<T>> collectionFactory = ArrayListSupplier.asFunction(); return toMultimap(source, keySelector, valueSelector, mapSupplier, collectionFactory); }