title: How to make multiple API calls in sequential order
body: <p>I need to call two APIs A1 and A2 but not parallelly. A2 would get called only if A1 returns some flag value in its JSON response.</p>
  
  <p>I'm aware of how to make an http call in java using Httpclient. one way is to write one code to make first call and parse its response and again use the same code to make another call.Is their any other smart way which automate this process for us where I will pass both the request and the condition on which second one need to call like it is possible in Rxjava</p>
  
  <p>Follwing is the Rxjava code snippet (Reference : (<a href="https://stackoverflow.com/questions/47641605/rxjava-combine-sequence-of-requests">RxJava Combine Sequence Of Requests</a>))</p>
  
  <pre><code>api1.items(queryParam)
  .flatMap(itemList -&gt; Observable.fromIterable(itemList)))
  .flatMap(item -&gt; api2.extendedInfo(item.id()))
  .subscribe(...)
  </code></pre>
  
  <p>How can I accomplish this in Java? Is there any Java feature that already exists and will allow me to make a multiple sequential call?</p>
  
  <p>I tried searching for existing solutions but they were not in Java.</p>