Retrofit and RxJava: How to combine two requests and get access to both results?

后端 未结 2 1052
挽巷
挽巷 2020-11-28 10:28

I need to make two requests for services and combine it results:

ServiceA() => [{\"id\":1,\"name\":\"title\"},{\"id\":1,\"name\":\"title\"}]

S

2条回答
  •  甜味超标
    2020-11-28 11:02

    The operator you are looking for is flatMap()

    serviceA.getAllGeneros("movie","list","da0d692f7f62a1dc687580f79dc1e6a0")
        .flatMap(genres -> serviceB.getAllMovies(genres.getId() ......))
    

提交回复
热议问题