以下“括号”如何?
val words = List("foo", "bar", "baz")
val phrase = "These are upper case: " + words map { _.toUpperCase } mkString ", "
是不是一样
val words = List("foo", "bar", "baz")
val phrase = "These are upper case: " + words.map(_.toUpperCase).mkString(", ")
换句话说,隐含的点(“.”)和括号是否与真实的具有相同的优先级?
第一个版本是否与第一个版本相同
val words = List("foo", "bar", "baz")
val phrase =
"These are upper case: " + (words map { _.toUpperCase } mkString ", ")