Android PagingDataAdapter不使用notifyItemChange更新我的项目

Android PagingDataAdapter不使用notifyItemChange更新我的项目,android,kotlin,android-paging,android-paging-3,Android,Kotlin,Android Paging,Android Paging 3,我试图更新列表中的一个特定项,问题是无论我的索引是什么总是返回-1 fun updateItem(item: Car) { val position = snapshot().items.indexOf(item) getItem(position) // Cant get item here, index is always -1 notifyItemChanged(position) } 我已经放置了调试器和snapshot()。it

我试图更新列表中的一个特定项,问题是无论我的
索引是什么
总是返回-1

fun updateItem(item: Car) {
        val position = snapshot().items.indexOf(item)
        getItem(position) // Cant get item here, index is always -1
        notifyItemChanged(position)
    }
我已经放置了调试器和
snapshot()。items
会向我返回一个
列表,该列表包含所有正确的值


现在,如果我给这个方法发送一个列表中的car,并尝试获取列表中项目的索引,它总是返回-1,不管发生什么,我只需要更新数组中的一个元素,但我不能,知道吗?

我们能看到car类定义吗?