GraywaterAdapter.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:Graywater 作者:
/**
 * Note that this is an <i>O(n)</i> operation, but it does not query for the list of binders.
 *
 * @param itemPosition
 *      the position in the list of items.
 * @return the number of viewholders before the given item position.
 */
@VisibleForTesting
public int getViewHolderCount(final int itemPosition) {
    if (itemPosition >= 0 && !mItemPositionToFirstViewHolderPositionCache.isEmpty()) {
        if (itemPosition >= mItemPositionToFirstViewHolderPositionCache.size()) {
            return mViewHolderToItemPositionCache.size();
        } else {
            return mItemPositionToFirstViewHolderPositionCache.get(itemPosition);
        }
    } else {
        return 0;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号