File tree Expand file tree Collapse file tree 2 files changed +5
-17
lines changed
language-adaptors/rxjava-scala/src
examples/scala/rx/lang/scala/examples Expand file tree Collapse file tree 2 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,11 @@ class RxScalaDemo extends JUnitSuite {
454
454
Thread .sleep(1500 ) // or convert to BlockingObservable
455
455
}
456
456
457
+ @ Test def takeWhileWithIndexAlternative {
458
+ val condition = true
459
+ Observable (" a" , " b" ).zipWithIndex.takeWhile{case (elem, index) => condition}.map(_._1)
460
+ }
461
+
457
462
def output (s : String ): Unit = println(s)
458
463
459
464
// blocks until obs has completed
Original file line number Diff line number Diff line change @@ -1185,23 +1185,6 @@ class Observable[+T] private[scala] (val asJava: rx.Observable[_ <: T])
1185
1185
def takeWhile (predicate : T => Boolean ): Observable [T ] = {
1186
1186
Observable [T ](asJava.takeWhile(predicate))
1187
1187
}
1188
-
1189
- /**
1190
- * Returns an Observable that emits the items emitted by a source Observable so long as a given
1191
- * predicate remains true, where the predicate can operate on both the item and its index
1192
- * relative to the complete sequence.
1193
- *
1194
- * <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/takeWhileWithIndex.png">
1195
- *
1196
- * @param predicate
1197
- * a function to test each item emitted by the source Observable for a condition;
1198
- * the second parameter of the function represents the index of the source item
1199
- * @return an Observable that emits items from the source Observable so long as the predicate
1200
- * continues to return `true` for each item, then completes
1201
- */
1202
- def takeWhileWithIndex (predicate : (T , Integer ) => Boolean ): Observable [T ] = {
1203
- Observable [T ](asJava.takeWhileWithIndex(predicate))
1204
- }
1205
1188
1206
1189
/**
1207
1190
* Returns an Observable that emits only the last `count` items emitted by the source
You can’t perform that action at this time.
0 commit comments