This article is a summary of the excerpts from tutorialspoint.com
2022-03-27 Today I learned what Kotlin Collections are and how they are used.
Referred to https://www.tutorialspoint.com/kotlin/index.htm
Collections
- Kotlin list - List is an ordered collection with access to elements by indices.
- Kotlin Set - Set is a collection of unique elements which means a group of objects without repetitions.
- Kotlin Map - Map is a set of key-value pairs. Keys are unique, and each of them maps to exactly one value.
Kotlin Collection Types
- Collection or Immutable Collection → not allowed changing values in a collection.
- Mutable Collection → allowed changing values in a collection.
Collections
- List - listOf(), listOf ()
- Map - mapOf()
- Set - setOf()
Mutable Collections
- List - ArrayList(), arrayListOf(), mutableListOf()
- Map - HashMap, hashMapOf(), mutableMapOf()
- Set - hashSetOf(), mutableSetOf()