title: How to get multiple data type from Observable since only one generic type from Observable<T> accepted
body: <p>We already know that Observable can only have one argument as its generic type. Observable
  I assume that I have 2 network calls which return 2 data type: <code>UserResponse</code> and <code>WorkResponse</code>.
  And I want to call 2 these APIs step by step, getUser then getWork.
  Finally I subscribe to them and got only one data type, obviously that's <code>WorkResponse</code> because getWork is the last API call in the upper stream <code>Observable&lt;WorkResponse&gt;</code>.
  But in the subscribe code block, I want to get both <code>UserResponse</code> and <code>WorkResponse</code>. So how can I achieve that?</p>
  
  <p>1 - Some people say that I should create a container class to contain both <code>UserResponse</code> and <code>WorkResponse</code> then I can get these data types from that container in subcribe code block.</p>
  
  <p>2 - Create a temporary variable to hold userResponse then access to it from subscibe code block, like the following:</p>
  
  <pre><code>class MainActivity : AppCompatActivity() {
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      var tempUserResponse: UserResponse? = null
      Observable.just("Prepare call API")
              .flatMap {
                  apiGetUser()
              }.flatMap { userResponse -&gt;
                  tempUserResponse = userResponse // Save temporarily userResponse to pass it to subscribe code block
                  apiGetWork()
              }.subscribeOn(Schedulers.io())
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe { workResponse -&gt;
                  Log.e("TAG", "userResponse = " + tempUserResponse)
                  Log.e("TAG", "workResponse = " + workResponse)
              }
  
  }
  
  private fun apiGetUser(): Observable&lt;UserResponse&gt; {
      // Fake API to get User
      return Observable.just(UserResponse())
  }
  
  private fun apiGetWork(): Observable&lt;Work&gt; {
      // Fake API to get Work
      return Observable.just(Work())
  }
  
  class Work
  class UserResponse
  
  }
  </code></pre>
  
  <p>3 - Is there another way?
  Please give me answer, thanks so much!</p>
  
  <p><strong>EDIT:</strong> Thanks for all your answers, guys! All your answers, may be different at the ways to implement (using <code>nested flatMap</code> or using <code>zip</code>) but we all need to use a 3rd class as a container class for all objects we need.
  Built-in container classes, we have: <code>Pair&lt;A, B&gt;</code> and <code>Triple&lt;A, B, C&gt;</code>
  . If we need more arguments, we must create our own ones</p>