-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Milestone
Description
According to Observable.takeUntil(ObservableSource other)'s documentation
Returns an Observable that emits the items emitted by the current Observable until a second ObservableSource emits an item.
Emphasis is mine
Looking at ObservableTakeUntil, it looks to me that onNext
and onComplete
are equivalent
I created this test, and the output is exactly the same
class TakeUntilTest {
@Test
fun `when Observable completes, then takeUntil completes`(){
Observable.just(1, 2, 3)
.takeUntil(Observable.empty<Unit>())
.subscribe(
{
println("Item: $it")
},
Timber::e,
{
println("onComplete")
}
)
}
@Test
fun `when Observable emits, then takeUntil completes`(){
Observable.just(1, 2, 3)
.takeUntil(Observable.just(Unit))
.subscribe(
{
println("Item: $it")
},
Timber::e,
{
println("onComplete")
}
)
}
}
According to documentation, the first test should emit 1, 2 and 3 values
Thus, I think the documentation should say something like
Returns an Observable that emits the items emitted by the current Observable until a second ObservableSource emits an item or completes successfully.
Thanks!
kaliaumem and TimoPtr