January 2018
Intermediate to advanced
434 pages
14h 1m
English
Kotlin provides a partition function. According to the documentation of the partition function it does the following:
Let's understand it more clearly by going through this example:
fun main(args: Array<String>) { val listA= listOf(1,2,3,4,5,6) val pair=listA.partition { it%2==0 } println(pair)}
This is the output:
([2, 4, 6], [1, 3, 5])
Read now
Unlock full access