DiffUtil.Callback 中的 getChangePayload(int oldItemPosition, int newItemPosition) 有什么用

What's the usage of getChangePayload(int oldItemPosition, int newItemPosition) in DiffUtil.Callback

DiffUtil.Callback 有方法

getChangePayload(int oldItemPosition, int newItemPosition)

When areItemsTheSame(int, int) returns true for two items and areContentsTheSame(int, int) returns false for them, DiffUtil calls this method to get a payload about the change.

For example, if you are using DiffUtil with RecyclerView, you can return the particular field that changed in the item and your ItemAnimator can use that information to run the correct animation.

Default implementation returns null.

覆盖这个方法有什么好处?

如何使用它?

与 RecyclerView 中的 Partial 和 Full 绑定的概念有关

detailed answer