swappedOrDefault

fun <T : Any> List<T>.swappedOrDefault(index1: Int, index2: Int): List<T>

Returns a shallow copy of this list with the items at index1 and index2 swapped. Returns the original collection if either index1 or index2 are not resent