rotated

fun <T> List<T>.rotated(distance: Int): List<T>

Returns a copy of this list rotated by distance positions.

The element at index i ends at index (i + distance).mod(size), so a positive distance shifts elements toward higher indexes. Any distance is accepted; it is normalized modulo the list size. An empty receiver yields an empty list.