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
You can use map operator. For example if you have lists of integers and you want to convert to lists of doubles:
List li = new ArrayList<>();
Observable.just(li).map( l -> {
List lr = new ArrayList();
for(Integer e:l) {
lr.add(e.doubleValue());
}
return lr;
});
But all it's a lot more natural if you can control the observable and change it to observe single elements instead of collections. Same code that converts single integer elements into double ones:
Observable.just(1,2,3).map( elem -> elem.doubleValue())