Set is a collection of distinct objects. If you try to add two or more objects to the Set that are equal (a == b), the second and subsequent ones are ignored.

As with List, the default creation function for Set (setOf()) creates an immutable Set. Use mutableSetOf() to create a Set that you can modify after creation.

You can learn more about this in:
Run Expand Edit