@Test public void areContentsTheSame_ComparesModelData() { boolean whenSameResult = callback.areContentsTheSame(0, 0); boolean whenDifferentResult = callback.areContentsTheSame(1, 1); assertThat(whenSameResult, is(true)); assertThat(whenDifferentResult, is(false)); }
@Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return mNewData.get(newItemPosition).equals(mOldData.get(oldItemPosition)); }
DefaultDiffCallback extends DiffUtil.Callback { @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return mNewData.get(newItemPosition).equals(mOldData.get(oldItemPosition)); } }
DefaultDiffCallback extends DiffUtil.Callback { @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return mNewData.get(newItemPosition).equals(mOldData.get(oldItemPosition)); } DefaultDiffCallback(@NonNull final List<D> oldData,
                               @NonNull final List<D> newData); }
DefaultDiffCallback extends DiffUtil.Callback { @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return mNewData.get(newItemPosition).equals(mOldData.get(oldItemPosition)); } DefaultDiffCallback(@NonNull final List<D> oldData,
                               @NonNull final List<D> newData); @Override boolean areContentsTheSame(int oldItemPosition, int newItemPosition); @Override boolean areItemsTheSame(int oldItemPosition, int newItemPosition); @Override int getNewListSize(); @Override int getOldListSize(); @NonNull List<D> getOldData(); @NonNull List<D> getNewData(); }
DefaultDiffCallback extends DiffUtil.Callback { @Override public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { return mNewData.get(newItemPosition).equals(mOldData.get(oldItemPosition)); } DefaultDiffCallback(@NonNull final List<D> oldData,
                               @NonNull final List<D> newData); @Override boolean areContentsTheSame(int oldItemPosition, int newItemPosition); @Override boolean areItemsTheSame(int oldItemPosition, int newItemPosition); @Override int getNewListSize(); @Override int getOldListSize(); @NonNull List<D> getOldData(); @NonNull List<D> getNewData();  }