While I use debounce(), then I extract data from the backend and the data I want to convert to other data and finally use toList(). when I use toList()nothing happens no log is in the subscription and error, without toList()it works, and the method subscribe()enters as much as I have a list of books, I tested the second part of the code without debounce()just getItems()and with the help toList()it works. Below is my code - the first part with debounce()and itList(), which does not work, and the second c toList(), which works
public Flowable<List<Book>> getItems(String query) {}
textChangeSubscriber
.debounce(300, TimeUnit.MILLISECONDS)
.observeOn(Schedulers.computation())
.switchMap(s -> getItems(s).toObservable())
.flatMapIterable(items -> items)
.map(Book::convert)
.toList()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(books -> {
Log.i("test", "" + books.toString());
}, error -> {
Log.i("test", "" + error);
});
getItems(query).flatMapIterable(items -> items)
.map(Book::convert)
.toList()
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(books -> {
Log.i("test", "" + "" + books.toString());
}, error -> {
Log.i("test", "" + error);
});
source
share