Set also has two variants in Kotlin, like List or any other collection—Set and MutableSet. Like List, Set is read-only and MutableList and MutableSet are the mutable versions of Set, which contain the read/write functionalities.
As with List, Set also has read-only properties and functions, such as size, isEmpty(), get(index: Int), and so on. We are not describing them here again to avoid redundant contents in this book. The big difference between Set and List is that, Set doesn't do ordering like List (unless you use OrderedSet), so it lacks the functions that involve orders, such as indexOf(item), add(index, item) , and so on.
Set, as you already know from earlier chapters, represents mathematical sets (the ones in Set theory).
From previous chapters, you already know that we cannot put duplicate items in sets. If...