what is the need for the List List List when there is vector?

advertisements

Vector is immutable,indexed,supports random access,efficient in Scala ; what is the need of immutable linear sequence List?


List is a very common data structure and it would be weird if it didn't exist.

List is better with prepend, head, and tail operations

List has less overhead compared to vector

If you don't need random access and only care about head/tail operations List makes sense. If you do need random access then Vector or some other data structure makes more sense.