java.lang.Object
cn.wjybxx.base.collection.DelayedCompressListImpl<E>
- 所有已实现的接口:
DelayedCompressList<E>
@NotThreadSafe
public final class DelayedCompressListImpl<E>
extends Object
implements DelayedCompressList<E>
- 作者:
- wjybxx date 2023/4/6
-
字段概要
从接口继承的字段 cn.wjybxx.base.collection.DelayedCompressList
INDEX_NOT_FOUND -
构造器概要
构造器构造器说明DelayedCompressListImpl(int initCapacity) DelayedCompressListImpl(Collection<? extends E> src) -
方法概要
修饰符和类型方法说明booleanbooleanaddAll(Collection<? extends E> c) 批量添加元素voidbeginItr()开始迭代voidclear()voidendItr()迭代结束 -- 必须在finally块中调用,否则可能使List处于无效状态void迭代List内的元素,该快捷方式不会迭代迭代期间新增的元素 如果需要元素的下标,请使用DelayedCompressList.forEach(ObjIntConsumer)voidforEach(ObjIntConsumer<? super E> action) 迭代List内的元素,该快捷方式不会迭代迭代期间新增的元素get(int index) 获取指定位置的元素int基于equals查找元素在List中的位置intindexOfRef(Object e) 基于引用相等查找元素在List中的位置boolean是否处于延迟压缩状态;是否在迭代期间删除了元素booleanisEmpty()boolean当前是否正在迭代boolean查询List是否真的为空 如果当前正在迭代,则可能产生遍历统计的情况,要注意开销问题。int基于equals逆向查找元素在List中的位置int基于引用相等逆向查找元素在List中的位置intrealSize()获取list的真实大小 如果当前正在迭代,则可能产生遍历统计的情况,要注意开销问题。removeAt(int index) 删除给定位置的元素将给定元素赋值到给定位置intsize()获取list的当前大小 注意:迭代期间删除的元素并不会导致size变化,因此该值是一个不准确的值。voidsort(Comparator<? super E> comparator) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.wjybxx.base.collection.DelayedCompressList
collectTo, contains, containsRef, indexCustom, lastIndexCustom, remove, removeRef
-
构造器详细资料
-
DelayedCompressListImpl
public DelayedCompressListImpl() -
DelayedCompressListImpl
public DelayedCompressListImpl(int initCapacity) -
DelayedCompressListImpl
-
-
方法详细资料
-
beginItr
public void beginItr()从接口复制的说明:DelayedCompressList开始迭代- 指定者:
beginItr在接口中DelayedCompressList<E>
-
endItr
public void endItr()从接口复制的说明:DelayedCompressList迭代结束 -- 必须在finally块中调用,否则可能使List处于无效状态- 指定者:
endItr在接口中DelayedCompressList<E>
-
isIterating
public boolean isIterating()从接口复制的说明:DelayedCompressList当前是否正在迭代- 指定者:
isIterating在接口中DelayedCompressList<E>
-
isDelayed
public boolean isDelayed()从接口复制的说明:DelayedCompressList是否处于延迟压缩状态;是否在迭代期间删除了元素- 指定者:
isDelayed在接口中DelayedCompressList<E>
-
add
- 指定者:
add在接口中DelayedCompressList<E>- 返回:
- 如果添加元素成功则返回true
-
addAll
从接口复制的说明:DelayedCompressList批量添加元素- 指定者:
addAll在接口中DelayedCompressList<E>
-
get
从接口复制的说明:DelayedCompressList获取指定位置的元素- 指定者:
get在接口中DelayedCompressList<E>- 返回:
- 如果指定位置的元素已删除,则返回null
-
set
从接口复制的说明:DelayedCompressList将给定元素赋值到给定位置- 指定者:
set在接口中DelayedCompressList<E>- 返回:
- 该位置的前一个值
-
removeAt
从接口复制的说明:DelayedCompressList删除给定位置的元素- 指定者:
removeAt在接口中DelayedCompressList<E>- 返回:
- 如果指定位置存在元素,则返回对应的元素,否则返回Null
-
clear
public void clear()- 指定者:
clear在接口中DelayedCompressList<E>
-
index
从接口复制的说明:DelayedCompressList基于equals查找元素在List中的位置- 指定者:
index在接口中DelayedCompressList<E>- 参数:
e- 如果null,表示查询第一个删除的的元素位置- 返回:
- 如果元素不在集合中,则返回-1
-
lastIndex
从接口复制的说明:DelayedCompressList基于equals逆向查找元素在List中的位置- 指定者:
lastIndex在接口中DelayedCompressList<E>- 参数:
e- 如果null,表示查询最后一个删除的的元素位置- 返回:
- 如果元素不在集合中,则返回-1
-
indexOfRef
从接口复制的说明:DelayedCompressList基于引用相等查找元素在List中的位置- 指定者:
indexOfRef在接口中DelayedCompressList<E>- 参数:
e- 如果null,表示查询第一个删除的的元素位置- 返回:
- 如果元素不在集合中,则返回-1
-
lastIndexOfRef
从接口复制的说明:DelayedCompressList基于引用相等逆向查找元素在List中的位置- 指定者:
lastIndexOfRef在接口中DelayedCompressList<E>- 参数:
e- 如果null,表示查询最后一个删除的的元素位置- 返回:
- 如果元素不在集合中,则返回-1
-
sort
- 指定者:
sort在接口中DelayedCompressList<E>
-
size
public int size()从接口复制的说明:DelayedCompressList获取list的当前大小 注意:迭代期间删除的元素并不会导致size变化,因此该值是一个不准确的值。- 指定者:
size在接口中DelayedCompressList<E>
-
isEmpty
public boolean isEmpty()- 指定者:
isEmpty在接口中DelayedCompressList<E>
-
realSize
public int realSize()从接口复制的说明:DelayedCompressList获取list的真实大小 如果当前正在迭代,则可能产生遍历统计的情况,要注意开销问题。- 指定者:
realSize在接口中DelayedCompressList<E>
-
isRealEmpty
public boolean isRealEmpty()从接口复制的说明:DelayedCompressList查询List是否真的为空 如果当前正在迭代,则可能产生遍历统计的情况,要注意开销问题。- 指定者:
isRealEmpty在接口中DelayedCompressList<E>
-
forEach
从接口复制的说明:DelayedCompressList迭代List内的元素,该快捷方式不会迭代迭代期间新增的元素 如果需要元素的下标,请使用DelayedCompressList.forEach(ObjIntConsumer)- 指定者:
forEach在接口中DelayedCompressList<E>
-
forEach
从接口复制的说明:DelayedCompressList迭代List内的元素,该快捷方式不会迭代迭代期间新增的元素- 指定者:
forEach在接口中DelayedCompressList<E>- 参数:
action- 参数1为对应元素,参数2为下标 -- 返回index以方便快速删除
-