【发布时间】:2021-03-20 20:28:12
【问题描述】:
有人可以帮忙吗?
我有这些功能
fun getBooks(): Single<List<Book>> {
return getCollections()
.map {
it.map(::collectonToBook)
}
}
fun getCollections(): Single<List<Collection>> {
return db.fetchCollections()
.filter(::isBook)
}
fun collectonToBook(collection: Collection): Maybe<Book> {
return collection.toBook()
}
问题是当我需要 Single<List<Book>> 时 getBooks 返回 Single<List<Maybe<Book>>>。我可以在流中做到这一点而不调用blockingGet吗?
【问题讨论】: