Convert Observable> to a sequence of Observable in RxJava

后端 未结 2 1053
耶瑟儿~
耶瑟儿~ 2021-01-31 06:58

Given a list of cars (List cars), I can do:

Observable.just(cars); //returns an Observable that emits one List
Observable.from         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-31 07:40

    You can map an Observable> to Observable like so:

    yourListObservable.flatMapIterable(x -> x)
    

    Note that flatMapping might not preserve the order of the source observable. If the order matters to you, use concatMapIterable. Read here for more details.

提交回复
热议问题