Rcv List Diff Util Call Back
DiffUtil.ItemCallback implementation for RecyclerView ListAdapter.
Provides lambda-based item comparison for efficient list updates.
RecyclerView ListAdapter를 위한 DiffUtil.ItemCallback 구현체입니다.
효율적인 리스트 업데이트를 위한 람다 기반 아이템 비교를 제공합니다.
Features:
Lambda-based flexible item comparison
Support for identity and content comparison
Optional payload generation for partial updates
Generic type support for any item type
기능:람다 기반 유연한 아이템 비교
동일성 및 내용 비교 지원
부분 업데이트를 위한 선택적 payload 생성
모든 아이템 타입에 대한 제네릭 타입 지원
Usage example:
val diffUtil = RcvListDiffUtilCallBack<User>(
itemsTheSame = { old, new -> old.id == new.id },
contentsTheSame = { old, new -> old == new },
changePayload = { old, new ->
if (old.name != new.name) "name" else null
}
)Parameters
The type of items to compare.
비교할 아이템의 타입.
Lambda to check if two items represent the same entity (e.g., ID comparison).
두 아이템이 같은 항목인지 확인하는 람다 (예: ID 비교).
Lambda to check if two items have the same content.
두 아이템의 내용이 같은지 확인하는 람다.
Lambda to generate payload for partial updates when items are the same but contents differ (nullable).
아이템이 같지만 내용이 다를 때 부분 업데이트용 payload를 생성하는 람다 (null 가능).
See also
For the ListAdapter that uses this DiffUtil callback.
이 DiffUtil 콜백을 사용하는 ListAdapter는 BaseRcvListAdapter를 참조하세요.
Constructors
Functions
Returns payload for partial update when items are the same but contents differ.
Called only when areItemsTheSame returns true and areContentsTheSame returns false.
아이템이 같지만 내용이 다를 때 부분 업데이트용 payload를 반환합니다.
areItemsTheSame이 true를 반환하고 areContentsTheSame이 false를 반환할 때만 호출됩니다.