2
跳出搜索輸入值,我想用switchMap()
與方法返回Flowable<List<T>>
我已經編輯我的代碼使用什麼@Maxim Ostrovidov建議,現在與debounce
我添加了3行,因爲想要去列表轉換爲其他時間和收到名單,但不起作用。我用它的工作原理其他情況下,這些三線,而與debounce
和switchMap
如何使用帶有Flowable數據的RxTextView switchMap?
.flatMapIterable(items -> items)
.map(Product::fromApi)
.toList()
subscription = RxTextView.textChangeEvents(searchInput)
.toFlowable(BackpressureStrategy.BUFFER)
.debounce(400, TimeUnit.MILLISECONDS)
.observeOn(Schedulers.computation())
.switchMap(event -> getItems(searchInput.getText().toString()))
.flatMapIterable(items -> items)
.map(Product::fromApi)
.toList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(/../);