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):

enter image description here

returned instance of class list has it's own apply method:

enter image description here

you can switch between class , object scaladoc clicking huge letter.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -