How to choose a collection class in Scala alvin June 2, 2015 - 8:19pm

This is an excerpt from the Scala Cookbook (partially re-worded for the internet). This is Recipe 10.2.

Scala FAQ: How do I choose a Scala collection class to solve a particular problem?


To being with, there are three main categories of collection classes to choose from:

Understanding the Scala collections hierarchy

This is an excerpt from the Scala Cookbook. (This is Recipe 10.1.)

Overview: The Scala collections hierarchy is very rich (both deep and wide), and understanding how it’s organized can be helpful when choosing a collection to solve a problem.


Figure 10-1, which shows the traits from which the Vector class inherits, demonstrates some of the complexity of the Scala collections hierarchy.

Scala List class examples: range, fill, tabulate, appending, foreach, more ...

Scala List FAQ: Can you share some Scala List class examples?

The Scala List class may be the most commonly used data structure in Scala applications. Therefore, it's very helpful to know how create lists, merge lists, select items from lists, operate on each element in a list, and so on.

In this tutorial, I'll share examples of the most common List operations (methods).