title: scala.collection.breakOut vs views
body: <p><a href="https://stackoverflow.com/a/1716558/936869">This SO answer</a> describes how <code>scala.collection.breakOut</code> can be used to prevent creating wasteful intermediate collections. For example, here we create an intermediate <code>Seq[(String,String)]</code>:</p>
  
  <pre><code>val m = List("A", "B", "C").map(x =&gt; x -&gt; x).toMap
  </code></pre>
  
  <p>By using <code>breakOut</code> we can prevent the creation of this intermediate <code>Seq</code>:</p>
  
  <pre><code>val m: Map[String,String] = List("A", "B", "C").map(x =&gt; x -&gt; x)(breakOut)
  </code></pre>
  
  <p><a href="http://www.scala-lang.org/docu/files/collections-api/collections_42.html" rel="noreferrer">Views solve the same problem</a> and in addition access elements lazily:</p>
  
  <pre><code>val m = (List("A", "B", "C").view map (x =&gt; x -&gt; x)).toMap
  </code></pre>
  
  <p>I am assuming the creation of the <code>View</code> wrappers is fairly cheap, so my question is: Is there any real reason to use <code>breakOut</code> over <code>View</code>s?</p>