Package org.miaixz.bus.core.center.list
Class BoundedList<E>
java.lang.Object
org.miaixz.bus.core.lang.wrapper.SimpleWrapper<List<E>>
org.miaixz.bus.core.center.list.ListWrapper<E>
org.miaixz.bus.core.center.list.BoundedList<E>
- Type Parameters:
E- 元素类型
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,SequencedCollection<E>,BoundedCollection<E>,Wrapper<List<E>>,Provider
指定边界大小的List 通过指定边界,可以限制List的最大容量
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields inherited from class org.miaixz.bus.core.lang.wrapper.SimpleWrapper
raw -
Constructor Summary
ConstructorsConstructorDescriptionBoundedList(int maxSize) 构造BoundedList(List<E> raw, int maxSize) 构造,限制集合的最大容量为提供的List -
Method Summary
Methods inherited from class org.miaixz.bus.core.center.list.ListWrapper
clear, contains, containsAll, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, parallelStream, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, stream, subList, toArray, toArrayMethods inherited from class org.miaixz.bus.core.lang.wrapper.SimpleWrapper
getRawMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, reversed
-
Constructor Details
-
BoundedList
public BoundedList(int maxSize) 构造- Parameters:
maxSize- 最大容量
-
BoundedList
构造,限制集合的最大容量为提供的List- Parameters:
raw- 原始对象maxSize- 最大容量
-
-
Method Details
-
isFull
public boolean isFull()Description copied from interface:BoundedCollection是否已满,如果集合已满,不允许新增元素- Specified by:
isFullin interfaceBoundedCollection<E>- Returns:
- 是否已满
-
maxSize
public int maxSize()Description copied from interface:BoundedCollection获取集合最大允许容量- Specified by:
maxSizein interfaceBoundedCollection<E>- Returns:
- 容量
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceList<E>- Overrides:
addin classListWrapper<E>
-
add
-
addAll
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceList<E>- Overrides:
addAllin classListWrapper<E>
-
addAll
-