title: Scala Future with filter in for comprehension
body: <p>In the example below I get the exception <code>java.util.NoSuchElementException: Future.filter predicate is not satisfied</code></p>
  
  <p>I want to have the result <code>Future( Test2 )</code> when the check <code>if( i == 2 )</code> fails. How do I handle filter/if within a for comprehension that deals with composing futures?</p>
  
  <p>Below is  a simplified example that works in the Scala REPL.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>import scala.concurrent.Future
  import scala.util.{ Try, Success, Failure }
  import scala.concurrent.ExecutionContext.Implicits.global
  
  val f1 = Future( 1 )
  val f2 = for {
    i &lt;- f1
    if( i == 2 )
  } yield "Test1"
  f2.recover{ case _ =&gt; "Test2" }
  f2.value
  </code></pre>