lib-manipulation/src/main/java/com/nhaarman/listviewanimations/itemmanipulation/animateaddition/InsertQueue.java
public void insert(final int index, @NonNull final T item) {
        if (mActiveIndexes.isEmpty() && mPendingItemsToInsert.isEmpty()) {
            mActiveIndexes.add(new AtomicInteger(index));
            //noinspection unchecked
            mInsertable.add(index, item);
        } else {
            mPendingItemsToInsert.add(new Pair<>(index, item));
        }
    }
public void insert(final int index, @NonNull final T item) {
        if (mActiveIndexes.isEmpty() && mPendingItemsToInsert.isEmpty()) {
            mActiveIndexes.add(new AtomicInteger(index));
            //noinspection unchecked
            mInsertable.add(index, item);
        } else {
            mPendingItemsToInsert.add(new Pair<>(index, item));
        }
    }
Insert an item into the queue at given index. Will directly call {@link Insertable#add(int,
Object)} if there are no active index-item pairs. Otherwise, the pair will be queued.

@param index the index at which the item should be inserted.
@param item  the item to insert.