Filter

Filter applies the supplied predicate function to the collection and returns the following result:

val numbers = listOf(1, 2, 3, 4, 5)
val smallerThan3 = numbers.filter { n -> n < 3 }

The resulting list has these numbers [1, 2].

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.43.124