scala - Where is List("String") described in API? -
when create new list of strings : val lines = list("this test" , "a new test")
calls method apply : override def apply[a](xs: a*): list[a] = xs.tolist
in case returns list[string]
reading scala doc list : http://www.scala-lang.org/api/current/#scala.collection.immutable.list
def apply(n: int): selects element index in sequence.
why different ? there section in api can view description of apply creating new list ?
you're messing list object's apply list class' apply.
first 1 creates list (note big o @ top, stands object):
returned instance of class list has it's own apply method:
you can switch between class , object scaladoc clicking huge letter.
Comments
Post a Comment