title: What is the best way to apply more than one CompletableFuture on result of another CompletableFuture?
body: <p>Lets make up an example:
  We have four methods: </p>
  
  <pre><code>CompletableFututre&lt;Void&gt; loadAndApply(SomeObject someObject);
  CompletableFuture&lt;SomeData&gt; loadData();
  A processA(SomeData data);
  B processB(SomeData data);
  </code></pre>
  
  <p><code>loadAndApply</code> combines all other methods. <code>loadData</code> gets data for a long time. Then we set <code>someObject.A</code> to result of running <code>processA(data)</code> and set <code>someObject.B</code> to result of running <code>processB(data)</code> 
  We can't apply both <code>processA</code> and <code>processB</code> at the same time because <code>processA</code> can only be run on <code>swingExecutor</code> and <code>processB</code> can be run only on <code>backgroundExecutor</code>.</p>
  
  <p>So my question here is: can we somehow chain all these methods in some good looking way?</p>
  
  <p>Currently I launch them like this:</p>
  
  <pre><code>CompletableFututre&lt;Void&gt; loadAndApply(SomeObject someObject) {
      return loadData()
        .thenApplyAsync(data -&gt; { someObject.setA(processA(data)); return data; }, swingExecutor)
        .thenAcceptAsync(data -&gt; someObject.setB(processB(data)), backgroundExecutor);
  }
  </code></pre>
  
  <p>is there any way looking better than <code>applyAsync</code> that actually does not apply anything on given object and just returns it for the next future?</p>