Class 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 java.util.Map<K,​V>>,​Subscriber<? super T>>, Function, Observable.Operator<java.util.Map<K,​V>,​T>

    public final class OperatorToMap<T,​K,​V>
    extends java.lang.Object
    implements Observable.Operator<java.util.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:
    Issue #96
    • Constructor Summary

      Constructors 
      Constructor Description
      OperatorToMap​(Func1<? super T,​? extends K> keySelector, Func1<? super T,​? extends V> valueSelector)
      ToMap with key selector, value selector and default HashMap factory.
      OperatorToMap​(Func1<? super T,​? extends K> keySelector, Func1<? super T,​? extends V> valueSelector, Func0<? extends java.util.Map<K,​V>> mapFactory)
      ToMap with key selector, value selector and custom Map factory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Subscriber<? super T> call​(Subscriber<? super java.util.Map<K,​V>> subscriber)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • keySelector

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

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

        private final Func0<? extends java.util.Map<K,​V>> mapFactory
    • Constructor Detail

      • 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 java.util.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