O'Reilly logo

Scala for the Impatient by Cay S. Horstmann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Maps and Tuples

Topics in This Chapter image

4.1 Constructing a Map — page 41

4.2 Accessing Map Values — page 42

4.3 Updating Map Values — page 43

4.4 Iterating over Maps — page 43

4.5 Sorted Maps — page 44

4.6 Interoperating with Java — page 44

4.7 Tuples — page 45

4.8 Zipping — page 46

Exercises — page 46

A classic programmer’s saying is, “If you can only have one data structure, make it a hash table.” Hash tables—or, more generally, maps—are among the most versatile data structures. As you will see in this chapter, Scala makes it particularly easy to use them.

Maps are collections of key/value pairs. Scala has a general ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required