title: Combining API calls with RX Java
body: <p>I'm new to RXJava and i'm having trouble understanding how to chain together the result of API calls.</p>
  
  <p>I'm making two API calls using retrofit, A and B, which both return an observable List of objects. Both API calls are independent so I want to make both at the same time, but to achieve my final result, I need to first take the result of A, do some work, then combine that with the result of B to populate my list adapter.</p>
  
  <ul>
  <li>Make API Call A</li>
  <li>Make API Call B </li>
  <li>Take A's result and create result X </li>
  <li><p>Take Result of B + X and populate adapter</p>
  
  <pre><code>@GET("/{object_id}/object_a")
      Observable&lt;List&lt;Object_A&gt;&gt; getObjectAList(
          @Path("object_id") long object_id);
  
  
  @GET("/{object_id}/object_b")
      Observable&lt;List&lt;Object_B&gt;&gt; getObjectBList(
          @Path("object_id") long object_id);
  </code></pre></li>
  </ul>
  
  <p>This is where I get lost trying to use RX java. I can take the result of api call A and do my work
  but I'm not sure how to take the result I just generated and combine it with API Call B.</p>
  
  <pre><code>aService. getObjectAList(object_a.getID())
              .subscribeOn(AndroidSchedulers.mainThread())
              .observeOn(AndroidSchedulers.main)
              .subscribe(new Action1&lt;List&lt;Object_A&gt;&gt;() {
  
                  @Override
                  public void call(List&lt;Section&gt; sections) {
                      // Do Stuff Here...
                      // Now i need to take this result and combine it with API Call B...
                  }
              });
  </code></pre>
  
  <p>I want to make both API calls at the same time, but i'm not sure how to chain together and combine API calls. Any help is appreciative.</p>