How to cancel a mapped Observable with specify condition at RxScala/Java?
<p>original observable ------a-------b-------c----------d-------->....<br>
mapped observable   -----A-------B(finish)<br>
Simple code as this:</p>

<pre><code>  val original = Observable.just('a', 'b', 'c', 'd')
  val mapped = original.map(x =&gt; x.toUpper)
  //how to let `mapped` Observable stop emit event when received 'b' from original?
  //do something
  mapped.subscribe(x =&gt; println(x)) //make it only print A ,B
</code></pre>

<p>How to make mapped observable finished at <code>B</code> this specify condition?</p>

<p><strong>UPDATE for takeUntil method</strong><br>
<code>takeUntil</code> seems a standard answer but my editer shows this method take <code>Observable[Any]</code> as paramter.See definition please,<br>
<code>def takeUntil(that: Observable[Any]): Observable[T]</code></p>

<p>if I use follows code</p>

<pre><code>  val original = Observable.just('a', 'b', 'c', 'd').takeUntil(x =&gt; x == 'b')
</code></pre>

<p>a compile error occurred</p>

<pre><code>Error:(74, 64) missing parameter type
  val original = Observable.just('a', 'b', 'c', 'd').takeUntil(x =&gt; x == 'b')
                                                           ^
</code></pre>

<p>Does we use a same package? my sbt dependency is   <code>"com.netflix.rxjava" % "rxjava-scala" % "0.20.7"</code></p>