title: RxJava2 Convert Flowable to Single
body: <p>How do I convert a Flowable to a Single? Or if there's another way to make it stop emitting after the first response that is also of interest.</p>
  
  <p>I've tried this but it doesn't seem to work:</p>
  
  <pre><code>  disposables.add(
          repository.getAllSomethings()
             .subscribeOn(SchedulerProvider.getInstance().computation())
             .observeOn(SchedulerProvider.getInstance().ui())
             .toSingle()
             .subscribeWith(object : DisposableSingleObserver&lt;List&lt;Something&gt;&gt;() {
                  override fun onSuccess(t: List&lt;Something&gt;) {
                  }
  
                  override fun onError(e: Throwable) {
                  }
              })
  </code></pre>
  
  <p>getAllSomethings() returns a <code>Flowable&lt;List&lt;Something&gt;&gt;</code></p>
  
  <p>In the above code <code>.subscribeWith()</code> is underlined in red complaining that: </p>
  
  <pre><code>Type parameter bound for E in 
  fun &lt;E : SingleObserver&lt;in Flowable&lt;List&lt;Something&gt;!&gt;!&gt;!&gt; subscribeWith(observer: E!): E!
  is not satisfied: inferred type  ! is not a subtype of SingleObserver&lt;in Flowable&lt;List&lt;Something&gt;!&gt;!&gt;!
  </code></pre>