T
T
Tsuzukeru2020-01-02 20:04:54
Java
Tsuzukeru, 2020-01-02 20:04:54

How to call an Rx method inside another Rx method?

There is a method methodA that makes a request to the server and returns an instance of the class in subscribe.

SearchRequestResponse(val a:String, val b:String, val c:MutableList<Video>)

Before this object reaches subscribe, I need to work on its c:MutableList field, namely, for each list value, call another asynchronous methodB() method and return the same SearchRequestResponse to subscribe, but with c:MutableList changed. Is it possible to do this before subscribe() or does c:MutableList need to be changed already in subscribe()?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2020-01-02
@Tsuzukeru

First, mutable data in an Rx stream is very, very bad. This can lead to a lot of bugs. The data must be immutable.
Secondly, you will need combineLatest , which takes a list of Observable. And you will get the list from your video list.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question