Reputation: 53816
In List source : http://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_7_7_final/src/library/scala/List.scala?view=markup
apply method on object List is defined as :
def apply[A](xs: A*): List[A] = xs.toList
as A
is not a type how is the toList
method available ?
Upvotes: 0
Views: 87
Reputation: 51271
xs
is defined as A*
which means that it's a Seq[A]
. That's how Scala does varargs: List()
, List(3,2,9)
, List('c','q')
, etc.
The toList
method comes from the Seq
class.
Upvotes: 3