public class FixedSizeList extends AbstractSerializableListDecorator implements BoundedCollection
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.
collection
Modifier | Constructor and Description |
---|---|
protected |
FixedSizeList(List list)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object object) |
boolean |
add(Object object) |
boolean |
addAll(Collection coll) |
boolean |
addAll(int index,
Collection coll) |
void |
clear() |
static List |
decorate(List list)
Factory method to create a fixed size list.
|
Object |
get(int index) |
int |
indexOf(Object object) |
boolean |
isFull()
Returns true if this collection is full and no new elements can be added.
|
Iterator |
iterator() |
int |
lastIndexOf(Object object) |
ListIterator |
listIterator() |
ListIterator |
listIterator(int index) |
int |
maxSize()
Gets the maximum size of the collection (the bound).
|
Object |
remove(int index) |
boolean |
remove(Object object) |
boolean |
removeAll(Collection coll) |
boolean |
retainAll(Collection coll) |
Object |
set(int index,
Object object) |
List |
subList(int fromIndex,
int toIndex) |
getList
contains, containsAll, equals, getCollection, hashCode, isEmpty, size, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, isEmpty, size, toArray, toArray
protected FixedSizeList(List list)
list
- the list to decorate, must not be nullIllegalArgumentException
- if list is nullpublic static List decorate(List list)
list
- the list to decorate, must not be nullIllegalArgumentException
- if list is nullpublic boolean add(Object object)
add
in interface Collection
add
in interface List
add
in class AbstractCollectionDecorator
public void add(int index, Object object)
add
in interface List
add
in class AbstractListDecorator
public boolean addAll(Collection coll)
addAll
in interface Collection
addAll
in interface List
addAll
in class AbstractCollectionDecorator
public boolean addAll(int index, Collection coll)
addAll
in interface List
addAll
in class AbstractListDecorator
public void clear()
clear
in interface Collection
clear
in interface List
clear
in class AbstractCollectionDecorator
public Object get(int index)
get
in interface List
get
in class AbstractListDecorator
public int indexOf(Object object)
indexOf
in interface List
indexOf
in class AbstractListDecorator
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
iterator
in class AbstractCollectionDecorator
public int lastIndexOf(Object object)
lastIndexOf
in interface List
lastIndexOf
in class AbstractListDecorator
public ListIterator listIterator()
listIterator
in interface List
listIterator
in class AbstractListDecorator
public ListIterator listIterator(int index)
listIterator
in interface List
listIterator
in class AbstractListDecorator
public Object remove(int index)
remove
in interface List
remove
in class AbstractListDecorator
public boolean remove(Object object)
remove
in interface Collection
remove
in interface List
remove
in class AbstractCollectionDecorator
public boolean removeAll(Collection coll)
removeAll
in interface Collection
removeAll
in interface List
removeAll
in class AbstractCollectionDecorator
public boolean retainAll(Collection coll)
retainAll
in interface Collection
retainAll
in interface List
retainAll
in class AbstractCollectionDecorator
public Object set(int index, Object object)
set
in interface List
set
in class AbstractListDecorator
public List subList(int fromIndex, int toIndex)
subList
in interface List
subList
in class AbstractListDecorator
public boolean isFull()
BoundedCollection
isFull
in interface BoundedCollection
true
if the collection is fullpublic int maxSize()
BoundedCollection
maxSize
in interface BoundedCollection
Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.