Kotlin Lists 2021
In today’s episode of Standard Library Safari, we’re learning all about lists! They’re the most popular kind of Kotlin collection for good reason, and we spend a whole episode diving into the details. We learn about how to create lists and mutable lists, and how to access, add, and remove elements. Together, we explore functionality around providing default values for invalid indexes, slicing, and mutating values using Kotin’s out-of-the-box features. We’ll also explore the concept of views on lists, investigate sub-lists and reversed views, and share many other tips and tricks.
This blog post accompanies this episode: https://dev.to/kotlin/exploring-kotlin-lists-in-2021-2gi
0:00 In today’s episode: Lists!
0:33 Creating lists
2:08 Accessing elements
3:36 Getting multiple items: slice
4:35 Mutable lists
5:00 Creating mutable lists
5:28 Adding elements
6:02 Removing elements
6:59 Updating elements
7:15 Filling and clearing mutable lists
8:04 Shuffling, sorting, reversing, and more
8:38 Retaining or…