File tree Expand file tree Collapse file tree 1 file changed +9
-21
lines changed
language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples Expand file tree Collapse file tree 1 file changed +9
-21
lines changed Original file line number Diff line number Diff line change @@ -1332,30 +1332,18 @@ class RxScalaDemo extends JUnitSuite {
13321332
13331333 @ Test def pivotExample () {
13341334 val o1 = (1 to 20 ).toObservable.groupBy(i => if (i <= 10 ) " x" else " y" ).map {
1335- case (t : String , o : Observable [Int ]) => (t, o.groupBy(i => if ( i % 2 == 0 ) true else false ))
1335+ case (t : String , o : Observable [Int ]) => (t, o.groupBy(i => i % 2 == 0 ))
13361336 }
13371337 println(" o1:" )
1338- o1.subscribe {
1339- n => n match {
1340- case (k1 : String , o : Observable [(Boolean , Observable [Int ])]) =>
1341- o.subscribe {
1342- m => m match {
1343- case (k2 : Boolean , oi : Observable [Int ]) => oi.subscribe(v => println(s " $k1 $k2 $v" ))
1344- }
1345- }
1346- }
1347- }
1338+ (for ((k1, o) <- o1;
1339+ (k2, vs) <- o;
1340+ v <- vs
1341+ ) yield (k1, k2, v)).subscribe(println(_))
13481342 val o2 = o1.pivot
13491343 println(" o2:" )
1350- o2.subscribe {
1351- n => n match {
1352- case (k1 : Boolean , o : Observable [(String , Observable [Int ])]) =>
1353- o.subscribe {
1354- m => m match {
1355- case (k2 : String , oi : Observable [Int ]) => oi.subscribe(v => println(s " $k1 $k2 $v" ))
1356- }
1357- }
1358- }
1359- }
1344+ (for ((k1, o) <- o2;
1345+ (k2, vs) <- o;
1346+ v <- vs
1347+ ) yield (k1, k2, v)).subscribe(println(_))
13601348 }
13611349}
You can’t perform that action at this time.
0 commit comments