接口 IndexedElementHelper<E>


public interface IndexedElementHelper<E>
该接口用于避免集合的中元素直接实现IndexedElement,以避免暴露不必要的接口
作者:
wjybxx date - 2024/8/5
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final int
    注意:未插入的节点的所以必须初始化为该值
  • 方法概要

    修饰符和类型
    方法
    说明
    int
    collectionIndex(Object collection, E element)
    获取对象在集合中的索引
    void
    collectionIndex(Object collection, E element, int index)
    设置其在集合中的索引
  • 字段详细资料

    • INDEX_NOT_FOUND

      static final int INDEX_NOT_FOUND
      注意:未插入的节点的所以必须初始化为该值
      另请参阅:
  • 方法详细资料

    • collectionIndex

      int collectionIndex(Object collection, E element)
      获取对象在集合中的索引
      参数:
      collection - 考虑到一个元素可能在多个队列中,因此传入队列引用
    • collectionIndex

      void collectionIndex(Object collection, E element, int index)
      设置其在集合中的索引
      参数:
      index - 如果是删除元素,则索引为-1