@@ -20,6 +20,8 @@ import rx.functions.FuncN
20
20
import rx .Observable .OnSubscribeFunc
21
21
import rx .lang .scala .observables .ConnectableObservable
22
22
import scala .concurrent .duration
23
+ import java .util
24
+ import collection .JavaConversions ._
23
25
24
26
25
27
/**
@@ -2379,7 +2381,9 @@ trait Observable[+T]
2379
2381
* Observable
2380
2382
*/
2381
2383
def toMap [K ] (keySelector : T => K ): Observable [Map [K , T ]]= {
2382
- toScalaObservable[Map [K ,T ]](asJavaObservable.toMap(keySelector))
2384
+ val thisJava = asJavaObservable.asInstanceOf [rx.Observable [T ]]
2385
+ val o : rx.Observable [util.Map [K , T ]] = thisJava.toMap[K ](keySelector)
2386
+ toScalaObservable[util.Map [K ,T ]](o).map(m => m.toMap)
2383
2387
}
2384
2388
2385
2389
/**
@@ -2399,7 +2403,9 @@ trait Observable[+T]
2399
2403
* Observable
2400
2404
*/
2401
2405
def toMap [K , V ] (keySelector : T => K , valueSelector : T => V ) : Observable [Map [K , V ]] = {
2402
- toScalaObservable[Map [K ,V ]](asJavaObservable.toMap(keySelector, valueSelector))
2406
+ val thisJava = asJavaObservable.asInstanceOf [rx.Observable [T ]]
2407
+ val o : rx.Observable [util.Map [K , V ]] = thisJava.toMap[K , V ](keySelector, valueSelector)
2408
+ toScalaObservable[util.Map [K , V ]](o).map(m => m.toMap)
2403
2409
}
2404
2410
2405
2411
/**
@@ -2417,8 +2423,10 @@ trait Observable[+T]
2417
2423
* @return an Observable that emits a single item: a Map that contains the mapped items emitted by the
2418
2424
* source Observable
2419
2425
*/
2420
- def toMap [K , V ] (keySelector : T => K , valueSelector : T => V , mapFactory : () => Map [K ,V ]): Observable [Map [K ,V ]] = {
2421
- toScalaObservable[Map [K ,V ]](asJavaObservable.toMap(keySelector, valueSelector, mapFactory))
2426
+ def toMap [K , V ] (keySelector : T => K , valueSelector : T => V , mapFactory : () => Map [K , V ]): Observable [Map [K , V ]] = {
2427
+ val thisJava = asJavaObservable.asInstanceOf [rx.Observable [T ]]
2428
+ val o : rx.Observable [util.Map [K , V ]] = thisJava.toMap[K , V ](keySelector, valueSelector)
2429
+ toScalaObservable[util.Map [K , V ]](o).map(m => mapFactory() ++ m.toMap)
2422
2430
}
2423
2431
2424
2432
}
0 commit comments