问题描述:

I need to get list of users:

API Endpoint:

Observable<List<User>> getUsers();

onNext(List<User> usersList)

I do not want to wait for the download of entire list.

I want to get user one by one.

Like this:

onNext(TempData singleUser)

how can I do that?

网友答案:

If you just want to convert Observable<List<User>> to Observable<User>, you can use getUsers().flatMapIterable(l -> l).

If you want to downloads and process the user list one by one, you need to change your API, since Observable<List<User>> getUsers() won't emit anything until the whole list is downloaded.

相关阅读:
Top