splitAt

fun <T> List<T>.splitAt(index: Int): Pair<List<T>, List<T>>

Splits the list into the elements before index and the elements from index onward.

Throws

when index is outside 0..size.