Tuples and Maps

Learn about tuples and maps in Scala.

We'll cover the following

Tuples

Scala has built-in support for tuples. A Tuple is a typed data structure for holding a number of elements (up to 22 in Scala). Tuples are useful whenever you are handling multiple related values, but don’t need all of the overhead of creating a new class.

Creating a Tuple is extremely simple. For example, here’s a tuple of two elements (Tuple2).

Get hands-on with 1400+ tech skills courses.