In Scala we have Seq - what is the use of that

Viewed 41

In Scala when we see the tree of scala.collection.immutable

We see that Seq extends Iterable. After that IndexDeq extends Seq & LinearSeq extends Seq. enter image description here

IndexedSeq - (which has Vector, String, Range) - Can be accessed in constant time as indexed LinerSeq - (which has List, Stack,Q) - Cannot be accessed in constant time as non- indexed . Guarantee LIFO/FIFO

The what is Seq ?

val aseq = Seq(1,2,3)

which both has get method aseq.(index). Also on print its shows as a List. This is confusing. How can we categorize as Seq. What is the use of this collection, why we call this a factory method.

0 Answers
Related