Coverage Summary for Class: MoveKt (com.vsevolodganin.clicktrack.utils.collection.immutable)
Class | Class, % | Method, % | Branch, % | Line, % | Instruction, % |
---|---|---|---|---|---|
MoveKt | 0% (0/1) | 0% (0/1) | 0% (0/8) | 0% (0/4) | 0% (0/39) |
package com.vsevolodganin.clicktrack.utils.collection.immutable
fun <T> List<T>.move(fromIndex: Int, toIndex: Int): List<T> {
if (fromIndex == toIndex || fromIndex !in indices) return this
return toMutableList().apply {
add(toIndex.coerceIn(indices), removeAt(fromIndex))
}
}