我有一些问题。我是 RxJava/RxKotlin/RxAndroid 的初学者,不了解某些功能。例如:
import rus.pifpaf.client.data.catalog.models.Category
import rus.pifpaf.client.data.main.MainRepository
import rus.pifpaf.client.data.main.models.FrontDataModel
import rus.pifpaf.client.data.product.models.Product
import rx.Observable
import rx.Single
import rx.lang.kotlin.observable
import java.util.*
class MainInteractor {
private var repository: MainRepository = MainRepository()
fun getFrontData() {
val cats = getCategories()
val day = getDayProduct()
val top = getTopProducts()
return Observable.zip(cats, day, top, MainInteractor::convert)
}
private fun getTopProducts(): Observable<List<Product>> {
return repository.getTop()
.toObservable()
.onErrorReturn{throwable -> ArrayList() }
}
private fun getDayProduct(): Observable<Product> {
return repository.getSingleProduct()
.toObservable()
.onErrorReturn{throwable -> Product()}
}
private fun getCategories(): Observable<List<Category>> {
return repository.getCategories()
.toObservable()
.onErrorReturn{throwable -> ArrayList() }
}
private fun convert(cats: List<Category>, product: Product, top: List<Product>): FrontDataModel {
}
}
然后我使用MainInteractor::convert Android studio 告诉我下一个
我尝试了很多变体并试图了解它想要什么,但没有成功。请帮助我...最好的问候。