public 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).
This class is Serializable from Commons Collections 3.1.
Modifier and Type | Method and Description |
---|---|
boolean |
add(E object) |
void |
add(int index,
E object) |
boolean |
addAll(java.util.Collection<? extends E> coll) |
boolean |
addAll(int index,
java.util.Collection<? extends E> coll) |
void |
clear() |
static <E> FixedSizeList<E> |
fixedSizeList(java.util.List<E> list)
Factory method to create a fixed size list.
|
E |
get(int index) |
int |
indexOf(java.lang.Object object) |
boolean |
isFull()
Returns true if this collection is full and no new elements can be added.
|
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object object) |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
int |
maxSize()
Gets the maximum size of the collection (the bound).
|
E |
remove(int index) |
boolean |
remove(java.lang.Object object) |
boolean |
removeAll(java.util.Collection<?> coll) |
boolean |
retainAll(java.util.Collection<?> coll) |
E |
set(int index,
E object) |
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
equals, hashCode
contains, containsAll, isEmpty, size, toArray, toArray, toString
public static <E> FixedSizeList<E> fixedSizeList(java.util.List<E> list)
E
- the type of the elements in the listlist
- the list to decorate, must not be nulljava.lang.NullPointerException
- if list is nullpublic boolean add(E object)
add
in interface java.util.Collection<E>
add
in interface java.util.List<E>
add
in class AbstractCollectionDecorator<E>
public void add(int index, E object)
add
in interface java.util.List<E>
add
in class AbstractListDecorator<E>
public boolean addAll(java.util.Collection<? extends E> coll)
addAll
in interface java.util.Collection<E>
addAll
in interface java.util.List<E>
addAll
in class AbstractCollectionDecorator<E>
public boolean addAll(int index, java.util.Collection<? extends E> coll)
addAll
in interface java.util.List<E>
addAll
in class AbstractListDecorator<E>
public void clear()
clear
in interface java.util.Collection<E>
clear
in interface java.util.List<E>
clear
in class AbstractCollectionDecorator<E>
public E get(int index)
get
in interface java.util.List<E>
get
in class AbstractListDecorator<E>
public int indexOf(java.lang.Object object)
indexOf
in interface java.util.List<E>
indexOf
in class AbstractListDecorator<E>
public java.util.Iterator<E> iterator()
public int lastIndexOf(java.lang.Object object)
lastIndexOf
in interface java.util.List<E>
lastIndexOf
in class AbstractListDecorator<E>
public java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
listIterator
in class AbstractListDecorator<E>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E>
listIterator
in class AbstractListDecorator<E>
public E remove(int index)
remove
in interface java.util.List<E>
remove
in class AbstractListDecorator<E>
public boolean remove(java.lang.Object object)
remove
in interface java.util.Collection<E>
remove
in interface java.util.List<E>
remove
in class AbstractCollectionDecorator<E>
public boolean removeAll(java.util.Collection<?> coll)
removeAll
in interface java.util.Collection<E>
removeAll
in interface java.util.List<E>
removeAll
in class AbstractCollectionDecorator<E>
public boolean retainAll(java.util.Collection<?> coll)
retainAll
in interface java.util.Collection<E>
retainAll
in interface java.util.List<E>
retainAll
in class AbstractCollectionDecorator<E>
public E set(int index, E object)
set
in interface java.util.List<E>
set
in class AbstractListDecorator<E>
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<E>
subList
in class AbstractListDecorator<E>
public boolean isFull()
BoundedCollection
isFull
in interface BoundedCollection<E>
true
if the collection is fullpublic int maxSize()
BoundedCollection
maxSize
in interface BoundedCollection<E>
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"