beginBatchedUpdates

Batches adapter updates that happen after calling this method and before calling endBatchedUpdates. For example, if you add multiple items in a loop and they are placed into consecutive indices, SortedList calls onInserted only once with the proper item count. If an event cannot be merged with the previous event, the previous event is dispatched to the callback instantly.

After running your data updates, you must call endBatchedUpdates which will dispatch any deferred data change event to the current callback.

A sample implementation may look like this:

    mSortedList.beginBatchedUpdates();
    try {
        mSortedList.add(item1)
        mSortedList.add(item2)
        mSortedList.remove(item3)
        ...
    } finally {
        mSortedList.endBatchedUpdates();
    }

Instead of using this method to batch calls, you can use a Callback that extends BatchedCallback. In that case, you must make sure that you are manually calling dispatchLastEvent right after you complete your data changes. Failing to do so may create data inconsistencies with the Callback.

If the current Callback is an instance of BatchedCallback, calling this method has no effect.