swap

fun <T> MutableList<T>.swap(index1: Int, index2: Int): MutableList<T>

Swaps values index1 with index2 in place. Throws IndexOutOfBoundsException when one or both indices are not present in the collection