![]() Val secondImmutableList = listOf(1, 2, 3, 4, 5) ![]() val immutableList = listOf("Cezary", "Katarzyna", "Aureliusz") Elements can be repeated in a list in anytime. Indice typically is an integer number that defines an element’s position. It is an ordered collection in which we can access to each element by indices. Immutable Collections List – listOf() and listOf() Mutable collections are the opposite, so any item‘s value can be changed. So once defined values cannot be reassigned. In a nutshell, immutable means that a collection or a variable supports only read-only functionalities. Some basic information about the immutability and mutability you can find in the post about Variables in Kotlin. In Kotlin collections are categorized in two forms: Immutable and mutable collections. Similar to Java Collections, Kotlin also provides a rich set of tools for managing collections.Ī collection usually contains a number of objects of the same type and these objects in the collection are called elements or items. ![]() Those type of concept was created to hold specific values for later usage. I can confidently say, that most applications could not work without data collections.
0 Comments
Leave a Reply. |