Fix replace function
Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
parent
ed4fd514f1
commit
a3b318b4df
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue