title: CompletableFuture | thenApply vs thenCompose
body: <p>I can't get my head around the difference between <code>thenApply</code> and <code>thenCompose</code>.</p>
  <p>So, could someone provide a valid use case?</p>
  <p>From the Java docs:</p>
  <pre><code>thenApply(Function&lt;? super T,? extends U&gt; fn)
  </code></pre>
  <blockquote>
  <p>Returns a new <code>CompletionStage</code> that, when this stage completes
  normally, is executed with this stage's result as the argument to the
  supplied function.</p>
  </blockquote>
  <pre><code>thenCompose(Function&lt;? super T,? extends CompletionStage&lt;U&gt;&gt; fn)
  </code></pre>
  <blockquote>
  <p>Returns a new <code>CompletionStage</code> that, when this stage completes
  normally, is executed with this stage as the argument to the supplied
  function.</p>
  </blockquote>
  <p>I get that the 2nd argument of <code>thenCompose</code> extends the CompletionStage where <code>thenApply</code> does not.</p>
  <p>Could someone provide an example in which case I have to use <code>thenApply</code> and when <code>thenCompose</code>?</p>