swap

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


fun <A, B> Pair<A, B>.swap(): Pair<B, A>

Swaps the order of the elements of the given Pair in a type-safe manner. Example: Pair("David", 32).swap() -> Pair(32, "David")