RxJava: How to convert List of objects to List of another objects

后端 未结 9 468
悲哀的现实
悲哀的现实 2021-01-31 07:30

I have the List of SourceObjects and I need to convert it to the List of ResultObjects.

I can fetch one object to another using method of ResultObject:

c         


        
9条回答
  •  北海茫月
    2021-01-31 07:48

    Non blocking conversion using nested map function

    val ints: Observable> = Observable.fromArray(listOf(1, 2, 3))
    
    val strings: Observable> = ints.map { list -> list.map { it.toString() } }
    

提交回复
热议问题