Package rx.internal.operators
Class OperatorToMultimap<T,K,V>
- java.lang.Object
-
- rx.internal.operators.OperatorToMultimap<T,K,V>
-
- Type Parameters:
T
- the value type of the inputK
- the multimap-key typeV
- the multimap-value type
- All Implemented Interfaces:
Func1<Subscriber<? super java.util.Map<K,java.util.Collection<V>>>,Subscriber<? super T>>
,Function
,Observable.Operator<java.util.Map<K,java.util.Collection<V>>,T>
public final class OperatorToMultimap<T,K,V> extends java.lang.Object implements Observable.Operator<java.util.Map<K,java.util.Collection<V>>,T>
Maps the elements of the source observable into a multimap (Map<K, Collection<V>>) where each key entry has a collection of the source's values.- See Also:
- Issue #97
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OperatorToMultimap.DefaultMultimapCollectionFactory<K,V>
The default collection factory for a key in the multimap returning an ArrayList independent of the key.static class
OperatorToMultimap.DefaultToMultimapFactory<K,V>
The default multimap factory returning a HashMap.
-
Field Summary
Fields Modifier and Type Field Description (package private) Func1<? super K,? extends java.util.Collection<V>>
collectionFactory
(package private) Func1<? super T,? extends K>
keySelector
private Func0<? extends java.util.Map<K,java.util.Collection<V>>>
mapFactory
(package private) Func1<? super T,? extends V>
valueSelector
-
Constructor Summary
Constructors Constructor Description OperatorToMultimap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector)
ToMultimap with key selector, custom value selector, default HashMap factory and default ArrayList collection factory.OperatorToMultimap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector, Func0<? extends java.util.Map<K,java.util.Collection<V>>> mapFactory)
ToMultimap with key selector, custom value selector, custom Map factory and default ArrayList collection factory.OperatorToMultimap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector, Func0<? extends java.util.Map<K,java.util.Collection<V>>> mapFactory, Func1<? super K,? extends java.util.Collection<V>> collectionFactory)
ToMultimap with key selector, custom value selector, custom Map factory and custom collection factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Subscriber<? super T>
call(Subscriber<? super java.util.Map<K,java.util.Collection<V>>> subscriber)
-
-
-
Constructor Detail
-
OperatorToMultimap
public OperatorToMultimap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector)
ToMultimap with key selector, custom value selector, default HashMap factory and default ArrayList collection factory.- Parameters:
keySelector
- the function extracting the map-key from the main valuevalueSelector
- the function extracting the map-value from the main value
-
OperatorToMultimap
public OperatorToMultimap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector, Func0<? extends java.util.Map<K,java.util.Collection<V>>> mapFactory)
ToMultimap with key selector, custom value selector, custom Map factory and default ArrayList collection factory.- Parameters:
keySelector
- the function extracting the map-key from the main valuevalueSelector
- the function extracting the map-value from the main valuemapFactory
- function that returns a Map instance to store keys and values into
-
OperatorToMultimap
public OperatorToMultimap(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector, Func0<? extends java.util.Map<K,java.util.Collection<V>>> mapFactory, Func1<? super K,? extends java.util.Collection<V>> collectionFactory)
ToMultimap with key selector, custom value selector, custom Map factory and custom collection factory.- Parameters:
keySelector
- the function extracting the map-key from the main valuevalueSelector
- the function extracting the map-value from the main valuemapFactory
- function that returns a Map instance to store keys and values intocollectionFactory
- function that returns a Collection for a particular key to store values into
-
-
Method Detail
-
call
public Subscriber<? super T> call(Subscriber<? super java.util.Map<K,java.util.Collection<V>>> subscriber)
-
-