Just like List, Set also has the following two variants in Kotlin:
- Set
- MutableSet
Set is read-only and MutableSet is the mutable version of Set, which contains the read-write functionalities.
Sets in collections represent mathematical sets (as in set theory).
The following is an example with MutableSet:
fun main(args: Array<String>) { val set = mutableSetOf(1,2,3,3,2) ...