Methods Summary |
---|
public void | clear(int key)Clears the given key and associated item from the adapter.
int index = mItems.indexOfKey(key);
if (index >= 0) {
mItems.removeAt(index);
notifyItemRangeRemoved(index, 1);
}
|
public void | clear()Removes all items from this adapter, leaving it empty.
final int itemCount = mItems.size();
if (itemCount == 0) {
return;
}
mItems.clear();
notifyItemRangeRemoved(0, itemCount);
|
public java.lang.Object | get(int position)
return mItems.valueAt(position);
|
public int | indexOf(java.lang.Object item)Returns the index for the given item in the adapter.
return mItems.indexOfValue(item);
|
public int | indexOf(int key)Returns the index for the given key in the adapter.
return mItems.indexOfKey(key);
|
public java.lang.Object | lookup(int key)Returns the object for the given key, or null if no mapping for that key exists.
return mItems.get(key);
|
public void | notifyArrayItemRangeChanged(int positionStart, int itemCount)Notify that the content of a range of items changed. Note that this is
not same as items being added or removed.
notifyItemRangeChanged(positionStart, itemCount);
|
public void | set(int key, java.lang.Object item)Sets the item for the given key.
int index = mItems.indexOfKey(key);
if (index >= 0) {
if (mItems.valueAt(index) != item) {
mItems.setValueAt(index, item);
notifyItemRangeChanged(index, 1);
}
} else {
mItems.append(key, item);
index = mItems.indexOfKey(key);
notifyItemRangeInserted(index, 1);
}
|
public int | size()
return mItems.size();
|