DiffUtil is a utility class that can calculate the difference between two lists and output a
list of update operations that converts the first list into the second one.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# android.support.v7.util\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\nandroid.support.v7.util\n=======================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\nInterfaces\n----------\n\n|-----------------------------------------------------------------------------|-----------------------------------------------------------------------------|\n| [ListUpdateCallback](/reference/android/support/v7/util/ListUpdateCallback) | An interface that can receive Update operations that are applied to a list. |\n\nClasses\n-------\n\n|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AdapterListUpdateCallback](/reference/android/support/v7/util/AdapterListUpdateCallback) | ListUpdateCallback that dispatches update events to the given adapter. |\n| [AsyncListUtil](/reference/android/support/v7/util/AsyncListUtil)\\\u003cT\\\u003e | A utility class that supports asynchronous content loading. |\n| [AsyncListUtil.DataCallback](/reference/android/support/v7/util/AsyncListUtil.DataCallback)\\\u003cT\\\u003e | The callback that provides data access for [AsyncListUtil](/reference/android/support/v7/util/AsyncListUtil). |\n| [AsyncListUtil.ViewCallback](/reference/android/support/v7/util/AsyncListUtil.ViewCallback) | The callback that links [AsyncListUtil](/reference/android/support/v7/util/AsyncListUtil) with the list view. |\n| [BatchingListUpdateCallback](/reference/android/support/v7/util/BatchingListUpdateCallback) | Wraps a [ListUpdateCallback](/reference/android/support/v7/util/ListUpdateCallback) callback and batches operations that can be merged. |\n| [DiffUtil](/reference/android/support/v7/util/DiffUtil) | DiffUtil is a utility class that can calculate the difference between two lists and output a list of update operations that converts the first list into the second one. |\n| [DiffUtil.Callback](/reference/android/support/v7/util/DiffUtil.Callback) | A Callback class used by DiffUtil while calculating the diff between two lists. |\n| [DiffUtil.DiffResult](/reference/android/support/v7/util/DiffUtil.DiffResult) | This class holds the information about the result of a [calculateDiff(Callback, boolean)](/reference/android/support/v7/util/DiffUtil#calculateDiff(android.support.v7.util.DiffUtil.Callback, boolean)) call. |\n| [DiffUtil.ItemCallback](/reference/android/support/v7/util/DiffUtil.ItemCallback)\\\u003cT\\\u003e | Callback for calculating the diff between two non-null items in a list. |\n| [SortedList](/reference/android/support/v7/util/SortedList)\\\u003cT\\\u003e | A Sorted list implementation that can keep items in order and also notify for changes in the list such that it can be bound to a [RecyclerView.Adapter](/reference/android/support/v7/widget/RecyclerView.Adapter). |\n| [SortedList.BatchedCallback](/reference/android/support/v7/util/SortedList.BatchedCallback)\\\u003cT2\\\u003e | A callback implementation that can batch notify events dispatched by the SortedList. |\n| [SortedList.Callback](/reference/android/support/v7/util/SortedList.Callback)\\\u003cT2\\\u003e | The class that controls the behavior of the [SortedList](/reference/android/support/v7/util/SortedList). |\n\n-\n\n Interfaces\n ----------\n\n - [ListUpdateCallback](/reference/android/support/v7/util/ListUpdateCallback)\n-\n\n Classes\n -------\n\n - [AdapterListUpdateCallback](/reference/android/support/v7/util/AdapterListUpdateCallback)\n - [AsyncListUtil](/reference/android/support/v7/util/AsyncListUtil)\n - [AsyncListUtil.DataCallback](/reference/android/support/v7/util/AsyncListUtil.DataCallback)\n - [AsyncListUtil.ViewCallback](/reference/android/support/v7/util/AsyncListUtil.ViewCallback)\n - [BatchingListUpdateCallback](/reference/android/support/v7/util/BatchingListUpdateCallback)\n - [DiffUtil](/reference/android/support/v7/util/DiffUtil)\n - [DiffUtil.Callback](/reference/android/support/v7/util/DiffUtil.Callback)\n - [DiffUtil.DiffResult](/reference/android/support/v7/util/DiffUtil.DiffResult)\n - [DiffUtil.ItemCallback](/reference/android/support/v7/util/DiffUtil.ItemCallback)\n - [SortedList](/reference/android/support/v7/util/SortedList)\n - [SortedList.BatchedCallback](/reference/android/support/v7/util/SortedList.BatchedCallback)\n - [SortedList.Callback](/reference/android/support/v7/util/SortedList.Callback)"]]