简体   繁体   中英

Convert Observable<Single<Object>> to Single<List<Object>>

Is there a possibility to convert Observable<Single<Object>> to Single<List<Object>> ? I'd also like to know whether it's possible to make the observable to wait for all the underlying singles to complete.

I imagine you could do it with something like this (untested):

myObservable
    .flatMap(x -> x)    // Flatten to Observable<Object>
    .toList()           // Collect in an Observable<List<Object>>
    .single();          // Convert to Single

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM