Take is the opposite of the drop function. It takes the first n elements from the collection:
val numbers = listOf(1, 2, 3, 4, 5)
val first2 = numbers.take(2)
The first2 list now has [1, 2].
Take is the opposite of the drop function. It takes the first n elements from the collection:
val numbers = listOf(1, 2, 3, 4, 5)
val first2 = numbers.take(2)
The first2 list now has [1, 2].
3.137.177.222