In the previous unit, you have learned about List and the operations you can perform on it. In this lesson, you’ll discover the collection Set as an immutable representation of a group of elements. Sets and lists have many features in common and similar syntax, with a fundamental difference: the items of a set are unique and have no order. You’ll see how to create a set and add and remove elements from it. You’ll discover how to manipulate its items using the map, flatten, and flatMap operations. Finally, you’ll chain multiple instances of Set using for-comprehension. In the capstone, you’ll use sets to store the book loans of a library.
Suppose you are writing a program to track which topics a student has selected, and each of them must be unique.
