scala.collection.breakOut vs views
问题 This SO answer describes how scala.collection.breakOut can be used to prevent creating wasteful intermediate collections. For example, here we create an intermediate Seq[(String,String)] : val m = List("A", "B", "C").map(x => x -> x).toMap By using breakOut we can prevent the creation of this intermediate Seq : val m: Map[String,String] = List("A", "B", "C").map(x => x -> x)(breakOut) Views solve the same problem and in addition access elements lazily: val m = (List("A", "B", "C").view map (x