37 Working with Map

After reading this lesson, you will be able to

  • Retrieve the value associated with a key
  • Get all keys and all values stored in a Map
  • Check its size and the feature of its entries
  • Filter its elements based on given criteria

In the previous lesson, you learned about the basics of Map. In this lesson, you’ll master the most common operations you can apply to it. You’ll use different strategies to retrieve a value linked to a given key. You’ll get the keys and the values in an instance of a Map. Finally, you will get its size, inquire about its entries’ properties, and filter its elements according to their characteristics by reusing the same methods you saw for List and Set. In the capstone, you will apply these operations ...

Get Get Programming with Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.