Class OperatorToMap<T,K,V>

java.lang.Object
rx.internal.operators.OperatorToMap<T,K,V>
Type Parameters:
T - the value type of the input
K - the map-key type
V - the map-value type
All Implemented Interfaces:
Func1<Subscriber<? super Map<K,V>>,Subscriber<? super T>>, Function, Observable.Operator<Map<K,V>,T>

public final class OperatorToMap<T,K,V> extends Object implements Observable.Operator<Map<K,V>,T>
Maps the elements of the source observable into a java.util.Map instance and emits that once the source observable completes.
See Also:
  • Field Details

    • keySelector

      final Func1<? super T,? extends K> keySelector
    • valueSelector

      final Func1<? super T,? extends V> valueSelector
    • mapFactory

      private final Func0<? extends Map<K,V>> mapFactory
  • Constructor Details

    • OperatorToMap

      public OperatorToMap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector)
      ToMap with key selector, value selector and default HashMap factory.
      Parameters:
      keySelector - the function extracting the map-key from the main value
      valueSelector - the function extracting the map-value from the main value
    • OperatorToMap

      public OperatorToMap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector, Func0<? extends Map<K,V>> mapFactory)
      ToMap with key selector, value selector and custom Map factory.
      Parameters:
      keySelector - the function extracting the map-key from the main value
      valueSelector - the function extracting the map-value from the main value
      mapFactory - function that returns a Map instance to store keys and values into
  • Method Details