title: Scala break out of map
body: <p>I need to break out of a seq map when a condition is met something like this where <code>foo</code> would return a list of objects where the size depends on how long it takes to find the targetId</p>
  
  <pre><code>def foo(ids: Seq[String], targetId: String) = ids.map(id =&gt; getObject(id)).until(id == targetId)
  </code></pre>
  
  <p>obviously the until method does not exist but I am looking for something that does the equivalent</p>