Go through a list returned by observable

0

I'm doing a query that returns a list of objects. Now I need to go through those objects and make another request in background for each object. But when doing the flatmap you are returning the list of items, so I need an operator before to go through that list as a for. Any ideas?

 public static Single<List<Item>> getRx() {

        return Single.create(singleSubscriber -> {
            query.findInBackground(new FindCallback<Item>() {
                @Override
                public void done(List<Item> objects, Error e) {                        
                   singleSubscriber.onSuccess(objects);
                }
            });
        });
    }

And here the error:

 getRx()
      .flatMap(item -> { //da error aqui ya que no es un item, es una lista de items
            return otherQuery(item);
        });
    
asked by Pablo Cegarra 10.03.2018 в 16:56
source

0 answers