/** * sets an item at the given position, overwriting the previous item * * @param position the relative position (position of this adapter) * @param item */ public void set(int position, IItem item) { if (mUseIdDistributor) { IdDistributor.checkId(item); } mItems.set(position, item); mapPossibleType(item); getFastAdapter().notifyAdapterItemChanged(getFastAdapter().getItemCount(getOrder()) + position); }
/** * add an item at the end of the existing items * * @param item */ public void add(IItem item) { if (mUseIdDistributor) { IdDistributor.checkId(item); } mItems.add(item); mapPossibleType(item); getFastAdapter() .notifyAdapterItemInserted(getFastAdapter().getItemCount(getOrder()) + mItems.size()); }
/** * set a new list of items for this adapter * * @param items */ public void set(List<IItem> items) { if (mUseIdDistributor) { IdDistributor.checkIds(items); } mItems = items; mapPossibleTypes(mItems); getFastAdapter() .notifyAdapterItemRangeChanged( getFastAdapter().getItemCount(getOrder()), getAdapterItemCount()); }
/** * add a list of items to the end of the existing items * * @param items */ public void add(List<IItem> items) { if (items != null) { if (mUseIdDistributor) { IdDistributor.checkIds(items); } mItems.addAll(items); mapPossibleTypes(items); getFastAdapter() .notifyAdapterItemRangeInserted(getFastAdapter().getItemCount(getOrder()), items.size()); } }
/** * add an array of items to the end of the existing items * * @param items */ public void add(IItem... items) { if (items != null) { if (mUseIdDistributor) { IdDistributor.checkIds(items); } Collections.addAll(mItems, items); mapPossibleTypes(Arrays.asList(items)); getFastAdapter() .notifyAdapterItemRangeInserted(getFastAdapter().getItemCount(getOrder()), items.length); } }