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
If your Observable
emits a List
, you can use these operators:
flatMapIterable
(transform your list to an Observable of items)map
(transform your item to another item) toList
operators (transform a completed Observable to a Observable which emit a list of items from the completed Observable)
Observable source = ...
source.flatMapIterable(list -> list)
.map(item -> new ResultsObject().convertFromSource(item))
.toList()
.subscribe(transformedList -> ...);