The Kotlin standard library provides a wide variety of useful functions. With these functions, we can begin writing more functional code without having to reinvent the wheel. In this section, we'll explore some common functional patterns that can be achieved by leveraging the Kotlin standard library.
Leveraging the standard library
Manipulating collections
Throughout this book, we've been making use of collections within our examples. The Kotlin standard library provides helper functions that make the creation of common collection types very easy:
fun main() {
val list = listOf("Kotlin", "Java", "Swift")
val mutableList = mutableListOf("Kotlin", "Java", "...