I'm new to Scala. And I noticed that List exists in both scala and scala.collection.immutable. At the beginning, I thought scala.List is just an alias for scala.collection.immutable.List. But later I found that:
scala> typeOf[scala.List[A]]
res1: reflect.runtime.universe.Type = scala.List[A]
scala> typeOf[scala.collection.immutable.List[A]]
res2: reflect.runtime.universe.Type = List[A]
As shown above, the typeof on these two Lists give different results, which make me doubious about my judgement.
I would like to know:
Are scala.List and scala.collection.immutable.List the same thing?
If yes, why typeOf gives different results as shown above?
If no, what are the differences?
Thanks!
scala.Listis a type alias forscala.collection.immutable.Listscalait has these two memberstype List[+A] = scala.collection.immutable.List[A]andval List = scala.collection.immutable.List. So yes... scala.List is just an alias forscala.collection.immutable.ListtypeOfgives different results on these two types?