Scala List class: methods, examples, and syntax
By Alvin Alexander. Last updated: July 15 2019
This page contains a large collection of examples of how to use the methods on the Scala List class.
The Scala List class as an immutable, linear, linked-list class. It’s very efficient when it makes sense for your algorithms to (a) prepend all new elements, (b) work with it in terms of its head and tail elements, and (c) use functional methods that traverse the list from beginning to end, such as filter
, map
, foldLeft
, reduceLeft
.