Fix replace function

Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
William Brawner 2023-03-05 10:38:31 -07:00
parent ed4fd514f1
commit a3b318b4df

View file

@ -18,7 +18,7 @@ interface Identifiable {
} }
inline fun <T : Identifiable> MutableList<T>.replace(item: T) { inline fun <T : Identifiable> MutableList<T>.replace(item: T) {
val index = indexOf(item) val index = indexOfFirst { it.id == item.id }
if (index > -1) { if (index > -1) {
removeAt(index) removeAt(index)
} }