9 lines
324 B
Kotlin
9 lines
324 B
Kotlin
package com.qft.optical
|
|
|
|
/** Move one item while preserving every other item's relative order. */
|
|
internal fun <T> moveQueueItem(items: MutableList<T>, from: Int, to: Int): Boolean {
|
|
if (from !in items.indices || to !in items.indices || from == to) return false
|
|
items.add(to, items.removeAt(from))
|
|
return true
|
|
}
|