我有一个方法getListFromDatabase()
返回了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
。我不知道什么是正确的语法?
答案 0 :(得分:0)
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.)
其中sendAnotherService()返回具有任何arg类型的Single。