title: How to filter list emitted by observable using result from another observable rx kotlin?
body: <p>Let say that I have a source of number list and observable which can value each number in that list. (Below method are required to be used. They are part of API which I <strong>have to</strong> use)</p>
  
  <pre><code>fun getNumberListSource() : Observable&lt;List&lt;Int&gt;&gt; {...}
  fun getOddChecker(value: Int): Observable&lt;Boolean&gt; {...}
  </code></pre>
  
  <p>Let say source could look like this:</p>
  
  <pre><code>class NumberSource {
  
      private val source = BehaviorSubject.create&lt;List&lt;Int&gt;&gt;()
  
      fun getNumberListSource(): Observable&lt;List&lt;Int&gt;&gt; = source.doOnNext { println("doOnNext :)") }
  
      fun start(){
          Thread {
              Thread.sleep(1000)
              source.onNext(listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))
              Thread.sleep(1000)
              source.onNext(listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))
              Thread.sleep(1000)
  
              source.onComplete()
          }.start()
  
      }
  }
  </code></pre>
  
  <p>fun getOddChecker(i: Int) : Observable = Observable.just(i%2== 0)</p>
  
  <p>at the end of the stream I need to have lists of odd numbers.
  So I done that code:</p>
  
  <pre><code>fun main() {
      val numberSource = NumberSource()
      numberSource.start()
      println("== started ==")
  
      numberSource.getNumberListSource()
          .flatMap {
              Observable.fromIterable(it)
                  .flatMap (
                      {getOddChecker(it)},
                      {a, b -&gt; a to b}
                  )
                  .filter { it.second }
                  .map { it.first }
                  .toList()
                  .toObservable()
          }
          .subscribe({ println("onNext: $it")},{},{ print("action:onComplete")})
  
  }
  </code></pre>
  
  <p>above code's output:</p>
  
  <pre><code>== started == 
  doOnNext :) 
  onNext: [2, 4, 6, 8, 10, 12] 
  doOnNext :) 
  onNext: [2, 4, 6, 8, 10, 12] 
  action:onComplete
  </code></pre>
  
  <p>Above code does what I want but I had to use <code>Pair</code> class. The part </p>
  
  <pre><code>        .filter { it.second }
          .map { it.first }
  </code></pre>
  
  <p>seems not quite readable.
  So is there any operator witch could simplify that code?      </p>