In my expression, even takeUntil
is true/false, subscribe method is emitting all the list items, which should stop once takeUntil
is true right?
Observable.fromIterable(countryResponseList.withIndex())
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.takeUntil((index,item) -> item.getId() == currentCountryCodeId)
.subscribe((index,item) -> run{
Log.d("items and index", " ${item} and ${index}")
})
What i need is to get the current index, when the expressions match( item.getId() == currentCountryCodeId) each other and the RxJava expression should stop continuing. I don't know how to do that, any help appreciated. I also found forEachWhile
, will that suit this situation?