【发布时间】:2014-05-31 00:07:33
【问题描述】:
当我创建一个新的字符串列表时:val lines = List("this is a test" , "a new test") 这个调用方法应用:override def apply[A](xs: A*): List[A] = xs.toList 在这种情况下返回一个 List[String]
阅读 Scala 文档以获取列表:http://www.scala-lang.org/api/current/#scala.collection.immutable.List
def apply(n: Int): A
Selects an element by its index in the sequence.
为什么会有所不同? API中是否有部分可以查看申请创建新列表的描述?
【问题讨论】:
标签: scala