Kotlin Tutorial #8: Collections — List, Set, Map, and Operations
In the previous tutorial, you learned about classes. Now let’s learn about collections — one of the most important topics in Kotlin. You will use collections in almost every program you write. Kotlin’s collections are powerful and expressive. You can filter, transform, group, and combine data with just a few lines of code. In this tutorial, you will learn: List, MutableList, Set, and Map filter, map, flatMap groupBy, sortedBy reduce and fold zip and associate Chaining operations together List A List is an ordered collection. listOf creates a read-only list. mutableListOf creates a list you can change. ...