AdapterHelper implements OpReorderer.Callback { void consumeUpdatesInOnePass() { consumePostponedUpdates(); final int count = mPendingUpdates.size(); for (int i = 0; i < count; i++) { UpdateOp op = mPendingUpdates.get(i); switch (op.cmd) { case UpdateOp.ADD: mCallback.onDispatchSecondPass(op); mCallback.offsetPositionsForAdd(op.positionStart, op.itemCount); break; case UpdateOp.REMOVE: mCallback.onDispatchSecondPass(op); mCallback.offsetPositionsForRemovingInvisible(op.positionStart, op.itemCount); break; case UpdateOp.UPDATE: mCallback.onDispatchSecondPass(op); mCallback.markViewHoldersUpdated(op.positionStart, op.itemCount, op.payload); break; case UpdateOp.MOVE: mCallback.onDispatchSecondPass(op); mCallback.offsetPositionsForMove(op.positionStart, op.itemCount); break; } if (mOnItemProcessedCallback != null) { mOnItemProcessedCallback.run(); } } recycleUpdateOpsAndClearList(mPendingUpdates); mExistingUpdateTypes = 0; } AdapterHelper(Callback callback);   AdapterHelper(Callback callback, boolean disableRecycler); int applyPendingUpdatesToPosition(int position); @Override UpdateOp obtainUpdateOp(int cmd, int positionStart, int itemCount, Object payload); @Override void recycleUpdateOp(UpdateOp op);  }
@Test public void testSinglePass() { setupBasic(10, 2, 3); add(2, 1); rm(1, 2); add(1, 5); mAdapterHelper.consumeUpdatesInOnePass(); assertDispatch(0, 3); }