为什么这样有效:
List(
"string", "string2"
)
但这不是吗?
List{
"string", "string2"
}
编译错误:;' expected but ',' found.
但是对于我自己的带有 apply 方法的对象:
object Dictionary {
...
private[dictionary] def apply(words: List[Word]) = {
...
}
}
Dictionary { // curly braces works fine
List ( // but here, for List - I can Not use curly braces
"hello", "hello2"
)
}