35 Working with Set

After reading this lesson, you will be able to

  • Perform union, intersection, and difference operations on sets
  • Inquire about the properties of a set
  • Select one of a set’s elements based on its features
  • Filter its items according to their characteristics

In the previous lesson, you learned about the structure of a set and how to transform its elements. In this lesson, you’ll discover other methods that the class Set has to offer. You’ll apply the operations of union, intersection, and difference on two sets. Then, I’ll introduce you to more complex transformations. You’ll notice a lot of overlap with the concepts you discovered for the List collection in unit 5. You’ll inquire about the properties of a set, such as its size ...

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.