Kotlin: working with collections

Example:

val numbers = listOf(1, 2, 3, 4, 5)
Kotlin has a rich set of operators to work with collections.

Solution:

val evenNumbers = numbers.filter { it % 2 == 0 }

Beginner's Guide to Kotlin