E - the type of elements in this collectionpublic class FixedSizeList<E> extends AbstractSerializableListDecorator<E> implements BoundedCollection<E>
List to fix the size preventing add/remove.
The add, remove, clear and retain operations are unsupported. The set method is allowed (as it doesn't change the list size).
NOTE: Modifying the decorated list directly would results in influencing the outcome of method calls on this object. For example, the bounds of this list would reflect a newly added object to the underlying list.
This class is Serializable from Commons Collections 3.1.
| 限定符 | 构造器和说明 |
|---|---|
protected |
FixedSizeList(List<E> list)
Constructor that wraps (not copies).
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E object) |
void |
add(int index,
E object) |
boolean |
addAll(Collection<? extends E> coll) |
boolean |
addAll(int index,
Collection<? extends E> coll) |
void |
clear() |
static <E> FixedSizeList<E> |
fixedSizeList(List<E> list)
Factory method to create a fixed size list.
|
E |
get(int index) |
int |
indexOf(Object object) |
boolean |
isFull()
Returns true if this collection is full and no new elements can be added.
|
Iterator<E> |
iterator() |
int |
lastIndexOf(Object object) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
int |
maxSize()
Gets the maximum size of the collection (the bound).
|
E |
remove(int index) |
boolean |
remove(Object object) |
boolean |
removeAll(Collection<?> coll) |
boolean |
retainAll(Collection<?> coll) |
E |
set(int index,
E object) |
List<E> |
subList(int fromIndex,
int toIndex) |
decorated, equals, hashCodecontains, containsAll, isEmpty, setCollection, size, toArray, toArray, toStringcontains, containsAll, equals, hashCode, isEmpty, parallelStream, removeIf, size, spliterator, stream, toArray, toArraycontains, containsAll, isEmpty, replaceAll, size, sort, spliterator, toArray, toArrayprotected FixedSizeList(List<E> list)
list - the list to decorate, must not be nullNullPointerException - if list is nullpublic static <E> FixedSizeList<E> fixedSizeList(List<E> list)
E - the type of the elements in the listlist - the list to decorate, must not be nullNullPointerException - if list is nullpublic boolean add(E object)
add 在接口中 Collection<E>add 在接口中 List<E>add 在类中 AbstractCollectionDecorator<E>public boolean addAll(Collection<? extends E> coll)
addAll 在接口中 Collection<E>addAll 在接口中 List<E>addAll 在类中 AbstractCollectionDecorator<E>public boolean addAll(int index,
Collection<? extends E> coll)
public void clear()
clear 在接口中 Collection<E>clear 在接口中 List<E>clear 在类中 AbstractCollectionDecorator<E>public int indexOf(Object object)
public int lastIndexOf(Object object)
lastIndexOf 在接口中 List<E>lastIndexOf 在类中 AbstractListDecorator<E>public ListIterator<E> listIterator()
listIterator 在接口中 List<E>listIterator 在类中 AbstractListDecorator<E>public ListIterator<E> listIterator(int index)
listIterator 在接口中 List<E>listIterator 在类中 AbstractListDecorator<E>public boolean remove(Object object)
remove 在接口中 Collection<E>remove 在接口中 List<E>remove 在类中 AbstractCollectionDecorator<E>public boolean removeAll(Collection<?> coll)
removeAll 在接口中 Collection<E>removeAll 在接口中 List<E>removeAll 在类中 AbstractCollectionDecorator<E>public boolean retainAll(Collection<?> coll)
retainAll 在接口中 Collection<E>retainAll 在接口中 List<E>retainAll 在类中 AbstractCollectionDecorator<E>public boolean isFull()
BoundedCollectionisFull 在接口中 BoundedCollection<E>true if the collection is full.public int maxSize()
BoundedCollectionmaxSize 在接口中 BoundedCollection<E>Copyright © 2022. All rights reserved.