Convert RxJava Observables To Live Data With Kotlin Extension Functions : <p>I've been using alot of RxJava <code>Observables</code> converted to <code>LiveData</code> in my code using <code>LiveDataReactiveStreams.fromPublisher()</code> library. So I though of adding an extension function to the RxJava Observable to easily convert them to <code>LiveData</code>.</p>

<p>These are my extension functions:</p>

<pre><code>fun &lt;T&gt; Flowable&lt;T&gt;.toLiveData() :  LiveData&lt;T&gt; {
    return LiveDataReactiveStreams.fromPublisher(this)
}

fun &lt;T&gt; Observable&lt;T&gt;.toLiveData(backPressureStrategy: BackpressureStrategy) :  LiveData&lt;T&gt; {
    return LiveDataReactiveStreams.fromPublisher(this.toFlowable(backPressureStrategy))
}

fun &lt;T&gt; Single&lt;T&gt;.toLiveData() :  LiveData&lt;T&gt; {
    return LiveDataReactiveStreams.fromPublisher(this.toFlowable())
}

fun &lt;T&gt; Maybe&lt;T&gt;.toLiveData() :  LiveData&lt;T&gt; {
    return LiveDataReactiveStreams.fromPublisher(this.toFlowable())
}

fun &lt;T&gt; Completable.toLiveData() :  LiveData&lt;T&gt; {
    return LiveDataReactiveStreams.fromPublisher(this.toFlowable())
}
</code></pre>

<p>My questions are:</p>

<ol>
<li>Is this a good idea?</li>
<li>Is there a better way of doing this?</li>
<li>Could these extension functions be better?</li>
</ol>

<p>P.S.</p>

<p>I'm new to Kotlin and so I am asking these question. Anything helpful would be appreciated. Thank you very much.</p>
