swap

fun <T> MutableList<T>.swap(i: Int, j: Int)

Exchanges the elements at i and j in place.

Throws

if i or j is not a valid index.