October 2019
Intermediate to advanced
434 pages
11h 54m
English
The Kotlin standard library provides a variety of functions for picking items out of a collection. These include functions such as find(), first(), and last(). Let's take a look at a few of these functions:
val list = listOf("Kotlin", "Java", "Swift", "K")val item = list.first()println(item)
Running this code will print out "Kotlin".
val list = listOf("Kotlin", "Java", "Swift", "K")val item = list.last()println(item)
This time, the code will print out "K".
val list = listOf("Kotlin", "Java", "Swift", "K")list.take(2)
Read now
Unlock full access