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 | Constructor and Description |
---|---|
protected |
FixedSizeList(List<E> list)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
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
contains, containsAll, equals, hashCode, isEmpty, setCollection, size, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, isEmpty, size, toArray, toArray
protected FixedSizeList(List<E> list)
list
- the list to decorate, must not be nullIllegalArgumentException
- 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 nullIllegalArgumentException
- if list is nullpublic boolean add(E object)
add
in interface Collection<E>
add
in interface List<E>
add
in class AbstractCollectionDecorator<E>
public void add(int index, E object)
public boolean addAll(Collection<? extends E> coll)
addAll
in interface Collection<E>
addAll
in interface List<E>
addAll
in class AbstractCollectionDecorator<E>
public boolean addAll(int index, Collection<? extends E> coll)
public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class AbstractCollectionDecorator<E>
public E get(int index)
public int indexOf(Object object)
public int lastIndexOf(Object object)
lastIndexOf
in interface List<E>
lastIndexOf
in class AbstractListDecorator<E>
public ListIterator<E> listIterator()
listIterator
in interface List<E>
listIterator
in class AbstractListDecorator<E>
public ListIterator<E> listIterator(int index)
listIterator
in interface List<E>
listIterator
in class AbstractListDecorator<E>
public E remove(int index)
public boolean remove(Object object)
remove
in interface Collection<E>
remove
in interface List<E>
remove
in class AbstractCollectionDecorator<E>
public boolean removeAll(Collection<?> coll)
removeAll
in interface Collection<E>
removeAll
in interface List<E>
removeAll
in class AbstractCollectionDecorator<E>
public boolean retainAll(Collection<?> coll)
retainAll
in interface Collection<E>
retainAll
in interface List<E>
retainAll
in class AbstractCollectionDecorator<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 © 2001–2013 The Apache Software Foundation. All rights reserved.