title: How to execute map, filter, flatMap using multiple threads in RxScala/Java?
body: <p>How to run <code>filter</code>, <code>map</code> and <code>flatMap</code> on <code>Observable</code> using multiple threads:</p>
  
  <pre><code>  def withDelay[T](delay: Duration)(t: =&gt; T) = {
      Thread.sleep(delay.toMillis)
      t
    }
  
    Observable
      .interval(500 millisecond)
      .filter(x =&gt; {
        withDelay(1 second) { x % 2 == 0 }
      })
      .map(x =&gt; {
        withDelay(1 second) { x * x }
      }).subscribe(println(_))
  </code></pre>
  
  <p>The goal is to run filtering and transformation operations concurrently using multiple threads.</p>