Commit f4ca6bcd authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Commit Bot

Add #add(position, index) to ListModelBase.

Change-Id: I81198806879df502bc3eb1b7522330c3c4a82805
Reviewed-on: https://chromium-review.googlesource.com/c/1491553
Commit-Queue: Jordan Demeulenaere <jdemeulenaere@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636066}
parent da979d1e
......@@ -54,6 +54,17 @@ public class ListModelBase<T, P> extends ListObservableImpl<P> implements Simple
notifyItemInserted(mItems.size() - 1);
}
/**
* Inserts a given {@code item} at position {@code position} of the held {@link List}.
* Notifies observers about the inserted item.
* @param position The position of the item to be inserted.
* @param item The item to be inserted.
*/
public void add(int position, T item) {
mItems.add(position, item);
notifyItemInserted(position);
}
/**
* Appends all given {@code items} to the last position of the held {@link List}.
* Notifies observers about the inserted items.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment