rxJava2 Combining Single, Maybe, Completable in complex Streams : <p>I am very excited with new RxJava <code>Sources</code> such as: <code>Single</code>, <code>Maybe</code>, <code>Completable</code>, which make your interfaces classes cleaner and prevent from a lot of mistakes during create of your 'Source' (e.g. forgetting to call <code>onComplete()</code>)</p>

<p>But it requires lots of boilerplate to combine them into a complex stream.</p>

<p>E.g. we have common Android situation of loading and caching data. Let's assume we have 2 sources <code>api</code> and <code>cache</code> and we would like to combine it:</p>

<pre><code>public interface Api {
    Single&lt;Integer&gt; loadFromNetwork();
}

public interface Cache {
    Maybe&lt;Integer&gt; loadFromCache(); //maybe because cache might not have item.
}
</code></pre>

<p>let's try to combine it:</p>

<pre><code>final Single&lt;Integer&gt; result = cache.loadFromCache()
        .switchIfEmpty(api.loadFromNetwork());
</code></pre>

<p>it will not compile, because <code>Maybe</code> doesn't have overload <code>Maybe.switchIfEmpty(Single):Single</code></p>

<p>so we have to convert everything:</p>

<pre><code>final Single&lt;Integer&gt; result = cache.loadFromCache()
        .switchIfEmpty(api.loadFromNetwork().toMaybe())
        .toSingle();
</code></pre>

<p>Another possible way to combine it also requires сonversion:</p>

<pre><code>final Single&lt;Integer&gt; result = Observable.concat(
            cache.loadFromCache().toObservable(),
            api.loadFromNetwork().toObservable()
        ).firstOrError();
</code></pre>

<p>So I don’t see any way to use the new sources without many transformations that add code noise and create a lot of extra objects.</p>

<p>Due to such issues, I can't use <code>Single</code>, <code>Maybe</code>, <code>Completable</code> and continue to use <code>Observable</code> everywhere.</p>

<p>So my question is: </p>

<ul>
<li><p>What are the best practices of combining <code>Single</code>, <code>Maybe</code>,
<code>Completable</code>.</p></li>
<li><p>Why these Sources don't have overloads to make combing easier.</p></li>
<li><p>Why these Sources don't have common ancestor and use it as<br>
parameter of <code>switchIfEmpty</code> and other methods?</p></li>
</ul>

<hr>

<p><strong>P.S.</strong> Does anybody know why these classes doesn't have any common hierarchy?<br>
From my perspective if some code can work for example with <code>Completable</code> it will also works fine with <code>Single</code> and <code>Maybe</code>?</p>
