Key Concepts

Review core concepts you need to learn to master this subject

Immutable Lists

var programmingLanguages = listOf("C#", "Java", "Kotlin", "Ruby")

An immutable list represents a group of elements with read-only operations.

It can be declared with the term listOf, followed by a pair of parentheses containing elements that are separated by commas.

Lists
Lesson 1 of 3
  1. 1
    In this section, we’re going to explore the various types of collections that exist in Kotlin. A collection is a group of elements that exist in a single structure. The first collection type we’l…
  2. 2
    In Kotlin, the terms “mutable” and “immutable” apply not only to variables but also to collections. Much like an immutable variable representing a read-only value, an immutable list contains item…
  3. 3
    A collection is of no use to us if we can’t access or work with its contents. In order to access the elements within a list, we must reference the element’s “index”. An index represents a numeric…
  4. 4
    Elements can be accessed from any list, but only with mutable lists can we change the contents of our list by adding, replacing, or removing elements. Previously we’ve only created immutable lists;…
  5. 5
    In Kotlin, the size property determines the number of elements within a collection. It is not only applicable to lists but also to other collections that we’ll be working with in the coming lessons…
  6. 6
    Every collection in Kotlin contains a series of built-in functions that allow us to perform certain operations in order to retrieve information about the collection or manipulate its values. A fu…
  7. 7
    Excellent work! In this lesson, we’ve learned the following concepts: - A list is a type of Kotlin Collection that contains ordered elements. - An immutable list is declared with listOf and indi…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo