title: Returning CompletableFuture<Void> in a conditional function
body: <p>I have an use case where I have to return a <code>CompletableFuture&lt;Void&gt;</code> from a function that composes 2 Completable Futures based on a condition.</p>
  
  <p>Below is what I have right now - </p>
  
  <pre class="lang-java prettyprint-override"><code>private CompletableFuture&lt;Void&gt; processSomething(final SomeEvent event) {
      final CompletableFuture&lt;PaginatedQueryList&lt;Detail&gt;&gt; detail = dao.getData(event.getOrderId());
      return detail.thenApply(n -&gt; n.stream()
          .filter(i -&gt; i.getBusinessType().equals(BusinessType.AWESOME))
          .findFirst()
          .filter(i -&gt; i.getLastUpdateEventTimestamp() &lt;= event.getCreationTime())) // This returns Optional&lt;Detail&gt;
          .thenCompose(i -&gt; i
             .map(o -&gt; deleteItem(event,o))
             .orElse(CompletableFuture.completedFuture(null))); // deleteItem is a async call that returns CompletableFuture&lt;Void&gt;
  }
  </code></pre>
  
  <p>Can the community check and and suggest any other approach ?<br>
  I particularly do not like returning explicitly  <code>CompletableFuture.completedFuture(null)</code>.</p>