@Test public void testToMapWithValueSelector() { Observable<String> source = Observable.from("a", "bb", "ccc", "dddd"); Observable<Map<Integer, String>> mapped = Observable.create(OperationToMap.toMap(source, lengthFunc, duplicate)); Map<Integer, String> expected = new HashMap<Integer, String>(); expected.put(1, "aa"); expected.put(2, "bbbb"); expected.put(3, "cccccc"); expected.put(4, "dddddddd"); mapped.subscribe(objectObserver); verify(objectObserver, never()).onError(any(Throwable.class)); verify(objectObserver, times(1)).onNext(expected); verify(objectObserver, times(1)).onCompleted(); }
public static <T, K> OnSubscribeFunc<Map<K, T>> toMap(Observable<T> source, Func1<? super T, ? extends K> keySelector) { return new ToMap<T, K, T>(source, keySelector, Functions.<T> identity(), new DefaultToMapFactory<K, T>()); }
OperationToMap { public static <T, K> OnSubscribeFunc<Map<K, T>> toMap(Observable<T> source, Func1<? super T, ? extends K> keySelector) { return new ToMap<T, K, T>(source, keySelector, Functions.<T> identity(), new DefaultToMapFactory<K, T>()); } }
OperationToMap { public static <T, K> OnSubscribeFunc<Map<K, T>> toMap(Observable<T> source, Func1<? super T, ? extends K> keySelector) { return new ToMap<T, K, T>(source, keySelector, Functions.<T> identity(), new DefaultToMapFactory<K, T>()); }  }
OperationToMap { public static <T, K> OnSubscribeFunc<Map<K, T>> toMap(Observable<T> source, Func1<? super T, ? extends K> keySelector) { return new ToMap<T, K, T>(source, keySelector, Functions.<T> identity(), new DefaultToMapFactory<K, T>()); }  static OnSubscribeFunc<Map<K, T>> toMap(Observable<T> source,
            Func1<? super T, ? extends K> keySelector); static OnSubscribeFunc<Map<K, V>> toMap(Observable<T> source,
            Func1<? super T, ? extends K> keySelector,
            Func1<? super T, ? extends V> valueSelector); static OnSubscribeFunc<Map<K, V>> toMap(Observable<T> source,
            Func1<? super T, ? extends K> keySelector,
            Func1<? super T, ? extends V> valueSelector,
            Func0<? extends Map<K, V>> mapFactory); }
OperationToMap { public static <T, K> OnSubscribeFunc<Map<K, T>> toMap(Observable<T> source, Func1<? super T, ? extends K> keySelector) { return new ToMap<T, K, T>(source, keySelector, Functions.<T> identity(), new DefaultToMapFactory<K, T>()); }  static OnSubscribeFunc<Map<K, T>> toMap(Observable<T> source,
            Func1<? super T, ? extends K> keySelector); static OnSubscribeFunc<Map<K, V>> toMap(Observable<T> source,
            Func1<? super T, ? extends K> keySelector,
            Func1<? super T, ? extends V> valueSelector); static OnSubscribeFunc<Map<K, V>> toMap(Observable<T> source,
            Func1<? super T, ? extends K> keySelector,
            Func1<? super T, ? extends V> valueSelector,
            Func0<? extends Map<K, V>> mapFactory);  }