scalascala-2.10seq

Scala - What is the difference between size and length of a Seq?


What is the difference between size and length of a Seq? When to use one and when the other?

scala> var a :Seq[String] = Seq("one", "two")
a: Seq[String] = List(one, two)

scala> a.size
res6: Int = 2

scala> a.length
res7: Int = 2

It's the same?

Thanks


Solution

  • Nothing. In the Seq doc, at the size method it is clearly stated: "The size of this sequence, equivalent to length.".