Change specific items in List when using DiffUtil
In case,
When there is a list with 100 items and wanna change only some of them, should I need to create a new list for comparison with DiffUtil?
fun fetchDynamicItems() {
val items = repository.fetchOnlyDynamicItems()
replaceDynamicItems(items)
}
fun replaceDynamicItems(dynamicItems: List) {
val oldList = getCurrentList()
val newList = getCurrentList().map {
when (it) {
is DynamicItem -> dynamicItems.get(matchedIndex)
else -> it
}...