我有两个改装请求
@GET("user/info")
Single<Infos> infoLists();
@GET("user/info/{id}")
Single<InfoDetail> shoppingListItem(@Path("id") int id);
接收UserInfos列表我想获取每个用户的更多详细信息
public Flowable<List<Single<UserExtended>>> test() {
return fetchInfoItems().
map(Items::items).
toObservable().
flatMapIterable(items -> items)
.map(itemDetail -> fetchUserDetail(itemDetail.getId())
.map(userInfoDetail -> new UserDetail(userInfoDetail.id,.....))
.toList()
.toFlowable();}
我希望在收到Flowable<List<UserExtended>>
Flowable<List<Single<UserExtended>>>
答案 0 :(得分:0)
尝试使用flatMapSingle(),您的gradle版本应为3.0.0-beta4
public Flowable<List<UserExtended>> test() {
return fetchInfoItems().
map(Items::items).
toObservable().
flatMapIterable(items -> items)
.flatMapSingle(itemDetail -> fetchUserDetail(itemDetail.getId())
.map(userInfoDetail -> new UserDetail(userInfoDetail.id,.....))
.toList()
.toFlowable();}