| package com.doumee.lib_coremodel.view.recyclerview.adapter; | 
|   | 
| import android.content.Context; | 
|   | 
| import androidx.databinding.ViewDataBinding; | 
| import androidx.recyclerview.widget.DiffUtil; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| public abstract class DiffBindingAdapter<T,DVB extends ViewDataBinding> extends DiffBaseRecyclerAdapter<T, BindingHolder<DVB>> { | 
|   | 
|     public DiffBindingAdapter(Context context, int layoutId, DiffUtil.ItemCallback<T> DIFF_CALLBACK) { | 
|         super(context, layoutId,DIFF_CALLBACK); | 
|     } | 
|   | 
|   | 
|     public T getItem(int position) { | 
|         if(position<getItemCount()){ | 
|             return getListData().get(position); | 
|         } | 
|         return null; | 
|     } | 
|   | 
|     public void refreshData(List<T> list){ | 
|         if(list!=null){ | 
|             setListData(list); | 
|         }else{ | 
|             setListData(new ArrayList<>()); | 
|         } | 
|     } | 
|   | 
|     public T getDataByPosition(int position) { | 
|         if (position >= 0 && position < getListData().size()) { | 
|             return getListData().get(position); | 
|         } | 
|         return null; | 
|     } | 
|   | 
|     public void clearData(){ | 
|         setListData(new ArrayList<>()); | 
|     } | 
| } |