Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OnSubscribeToMap<T, K, V>

extends Object
implements Observable.OnSubscribe<Map<K, V>>, Func0<Map<K, V>>
Class Inheritance
All Implemented Interfaces
rx.functions.Func0, java.util.concurrent.Callable, rx.functions.Function, rx.Observable.OnSubscribe, rx.functions.Action1, rx.functions.Action
Type Parameters
<T>
the value type of the input
<K>
the map-key type
<V>
the map-value type
Imports
java.util.HashMap, .Map, rx.Observable, .Observable.OnSubscribe, .Subscriber, rx.exceptions.Exceptions, rx.functions.Func0, .Func1

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final Func1<? super T, ? extends K>
pack-priv final Func0<? extends Map<K, V>>
pack-priv final Observable<T>
pack-priv final Func1<? super T, ? extends V>

Constructor Summary

AccessConstructor and Description
public
OnSubscribeToMap(Observable<T>
the source Observable instance
source
,
Func1<? super T, ? extends K>
the function extracting the map-key from the main value
keySelector
,
Func1<? super T, ? extends V>
the function extracting the map-value from the main value
valueSelector
)

ToMap with key selector, value selector and default HashMap factory.

public
OnSubscribeToMap(Observable<T>
the source Observable instance
source
,
Func1<? super T, ? extends K>
the function extracting the map-key from the main value
keySelector
,
Func1<? super T, ? extends V>
the function extracting the map-value from the main value
valueSelector
,
Func0<? extends Map<K, V>>
function that returns a Map instance to store keys and values into
mapFactory
)

ToMap with key selector, value selector and custom Map factory.

Method Summary

Modifier and TypeMethod and Description
public Map<K, V>
call()

Implements rx.functions.Func0.call.

Computes a result, or throws an exception if unable to do so.
public void
call(final Subscriber<? super Map<K, V>> subscriber)

Implements rx.functions.Action1.call.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keySelectorback to summary
pack-priv final Func1<? super T, ? extends K> keySelector
mapFactoryback to summary
pack-priv final Func0<? extends Map<K, V>> mapFactory
sourceback to summary
pack-priv final Observable<T> source
valueSelectorback to summary
pack-priv final Func1<? super T, ? extends V> valueSelector

Constructor Detail

OnSubscribeToMapback to summary
public OnSubscribeToMap(Observable<T> source, Func1<? super T, ? extends K> keySelector, Func1<? super T, ? extends V> valueSelector)

ToMap with key selector, value selector and default HashMap factory.

Parameters
source:Observable<T>

the source Observable instance

keySelector:Func1<? super T, ? extends K>

the function extracting the map-key from the main value

valueSelector:Func1<? super T, ? extends V>

the function extracting the map-value from the main value

OnSubscribeToMapback to summary
public OnSubscribeToMap(Observable<T> source, 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
source:Observable<T>

the source Observable instance

keySelector:Func1<? super T, ? extends K>

the function extracting the map-key from the main value

valueSelector:Func1<? super T, ? extends V>

the function extracting the map-value from the main value

mapFactory:Func0<? extends Map<K, V>>

function that returns a Map instance to store keys and values into

Method Detail

callback to summary
public Map<K, V> call()

Implements rx.functions.Func0.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:Map<K, V>

computed result

Annotations
@Override
callback to summary
public void call(final Subscriber<? super Map<K, V>> subscriber)

Implements rx.functions.Action1.call.

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OnSubscribeToMap.ToMapSubscriber<T, K, V>

extends DeferredScalarSubscriberSafe<T, Map<K, V>>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Func1<? super T, ? extends K>
pack-priv final Func1<? super T, ? extends V>
Inherited from rx.internal.operators.DeferredScalarSubscriberSafe:
done

Constructor Summary

AccessConstructor and Description
pack-priv
ToMapSubscriber(Subscriber<? super Map<K, V>> actual, Map<K, V> map, Func1<? super T, ? extends K> keySelector, Func1<? super T, ? extends V> valueSelector)

Method Summary

Modifier and TypeMethod and Description
public void
onNext(T
the item emitted by the Observable
t
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
public void
onStart()

Overrides rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber.
Inherited from rx.internal.operators.DeferredScalarSubscriberSafe:
onCompletedonError

Field Detail

keySelectorback to summary
pack-priv final Func1<? super T, ? extends K> keySelector
valueSelectorback to summary
pack-priv final Func1<? super T, ? extends V> valueSelector

Constructor Detail

ToMapSubscriberback to summary
pack-priv ToMapSubscriber(Subscriber<? super Map<K, V>> actual, Map<K, V> map, Func1<? super T, ? extends K> keySelector, Func1<? super T, ? extends V> valueSelector)

Method Detail

onNextback to summary
public void onNext(T t)

Implements rx.Observer.onNext.

Doc from rx.Observer.onNext.

Provides the Observer with a new item to observe.

The Observable may call this method 0 or more times.

The Observable will not call this method again after it calls either onCompleted or onError.

Parameters
t:T

the item emitted by the Observable

Annotations
@Override
onStartback to summary
public void onStart()

Overrides rx.Subscriber.onStart.

Doc from rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.

Annotations
@Override