When I enter Seq(1,2,3) in the REPL, it returns me List(1,2,3)
scala> Seq(1,2,3) res8: Seq[Int] = List(1, 2, 3)
Therefore, I thought that List(1,2,3) could be of type List[Int] . And I tried to specify the type of the variable that is assigned the value of Seq(1,2,3) , but unexpectedly REPL complains as follows:
scala> val a:List[Int]=Seq(1,2,3) <console>:20: error: type mismatch; found : Seq[Int] required: List[Int] val a:List[Int]=Seq(1,2,3)
Does anyone have any ideas on what Seq[Int] = List(1, 2, 3) means? Doesn't that mean that Seq(1,2,3) returns a list? What is the difference between Seq[Int] and List[Int] ? And how to convert between Seq and List ?
source share