Splits the original collection into pair of lists by the given predicate.
Syntax
collection.partition { predicate }Example
Enter values below to update the example in real time.
val→evens→odds→listOf→it→println→val (evens, odds) = listOf(1, 2, 3, 4, 5).partition { it % 2 == 0 }
println(evens) // [2, 4]
println(odds) // [1, 3, 5]