Creating a List
Constructing Lists Using :: and nil
Appending Elements
Prepending Elements
List Concatenation
Head & Tail
ListBuffer
Introduction
A List in Scala is a collection which comes under the Seq class. It is an immutable collection and hence when modified the original List does not get updated, rather, a new List is created.
Like Arrays and ArrayBuffers, Lists store elements of the same type.
Creating a List
Lists can be created and populated in multiple different ways, most of which are identical to the approaches we went over when discussing Arrays. Let’s quickly go over them.