title: Yield only if pattern match
body: <p>I am building a list of different case class objects based on a loop and a pattern match. <strong>I want to exclude (skip) the items hitting the default case</strong> (essentially filtering the list, and mapping to types in one step).</p>
  
  <p>I'm probably too new to Scala to see all the possibilities. My attempt:</p>
  
  <pre><code>    val events = for (ev &lt;- data ) yield {
  
          ev.sport match {
              case "FOOTBALL" =&gt; new FootballEvent(ev)
              case "SOCCER" =&gt; new SoccerEvent(ev)
              case _ =&gt; None
          }
  
      }
  </code></pre>
  
  <p>I could filter the list afterwards, but I suspect there's some fancy Scala way of doing this :)</p>
  
  <p>Please let me know if you have any idea of how this should best be done!</p>