moved

fun <T> List<T>.moved(fromIndex: Int, toIndex: Int): List<T>

Returns a copy of this list with the element at fromIndex moved so that it sits at toIndex in the result.

Elements between the two positions shift by one. The receiver is not modified.

Throws

if fromIndex or toIndex is not a valid index of this list.