I have some code that is producing a Map where the values are Option types, and I really of course want a map containing only the real values.
Map
Option
for ((k, Some(v)) <- input) yield (k, v)
It's franza's answer from a later question, but it deserves a re-post here.
input flatMap {case(k,ov) => ov map {v => (k, v)}}
input.collect{case (k, Some(v)) => (k,v)}