title: How can I intercept an observable object and modify it in RxJava before returning to Subscriber?
body: <p>I'm currently trying to hit a service and get returned a list of objects, before it gets returned to the subscriber, I want to make another synchronous call for each object in the list to make another service call to set a missing field. I'm successfully having all calls being made, but the object returned in the subscriber has this field I need to have set to null. Here is an example of my code:</p>
  
  <p>Example Service: </p>
  
  <pre><code>rx.Observable&lt;List&lt;ExampleObject&gt;&gt; getExampleObject();
  rx.Observable&lt;MissingObject&gt; getMissingObjectByFoo(@Path("foo") String foo);
  </code></pre>
  
  <p>Example Class:</p>
  
  <pre><code>public class ExampleObject {
      String foo;
      MissingObject bar;
  
      public String getFoo() {
          return this.foo;
      }
  
      public void setFoo(String value) {
          this.foo = value;
      }
  
      public MissingObject getBar() {
          return this.bar;
      }
  
      public void setBar(MissingObject value) {
          this.bar = value;
      }
  }
  </code></pre>
  
  <p>Example Implementation:</p>
  
  <pre><code>mService.getExampleObject().flatMap(new Func1&lt;List&lt;ExampleObject&gt;, Observable&lt;?&gt;&gt;() {
              @Override
              public Observable&lt;List&lt;ExampleObject&gt;&gt; call(List&lt;ExampleObject&gt; exampleObjects) {
                  for (ExampleObject entry : exampleObjects) {
                      String foo = entry.getFoo();
                      mService.getMissingObjectByFoo(foo)
                              .subscribeOn(mScheduler.backgroundThread())
                              .observeOn(mScheduler.mainThread())
                              .subscribe(new Subscriber&lt;MissingObject&gt;() {
                          @Override
                          public void onCompleted() {
  
                          }
  
                          @Override
                          public void onError(Throwable e) {
  
                          }
  
                          @Override
                          public void onNext(MissingObject missingObject) {
                              entry.setBar(missingObject);
                          }
                      });
                  }
                  return Observable.just(exampleObjects);
              };
  </code></pre>