RxJava:链接两个平面图
RxJava: chain two flatmaps
我有一个方法 getListFromDatabase()
returns Single<List<User>> users
,我想做的是:
getListFromDatabase()
.flatMap(// send list to another server)
.flatMap(// check if there are users that I have to added manually from a bundle, here I needs database connexion so I have to do this asynchronously, and I need the list I just retrieved)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(// handle onSuccess, onError etc.)
但是在第一个flatMap中,它一直告诉我missing return statement
。我不知道什么是正确的语法?
getListFromDatabase()
.flatMap(users -> sendAnotherService().map(ingoreResult -> users))
.flatMap(// check if there are users that I have to added manually from a bundle, here I needs database connexion so I have to do this asynchronously, and I need the list I just retrieved)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(// handle onSuccess, onError etc.)
where sendAnotherService() return 带有任何类型参数的单个。
我有一个方法 getListFromDatabase()
returns Single<List<User>> users
,我想做的是:
getListFromDatabase()
.flatMap(// send list to another server)
.flatMap(// check if there are users that I have to added manually from a bundle, here I needs database connexion so I have to do this asynchronously, and I need the list I just retrieved)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(// handle onSuccess, onError etc.)
但是在第一个flatMap中,它一直告诉我missing return statement
。我不知道什么是正确的语法?
getListFromDatabase()
.flatMap(users -> sendAnotherService().map(ingoreResult -> users))
.flatMap(// check if there are users that I have to added manually from a bundle, here I needs database connexion so I have to do this asynchronously, and I need the list I just retrieved)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(// handle onSuccess, onError etc.)
where sendAnotherService() return 带有任何类型参数的单个。