org.apache.commons.collections.list

Class FixedSizeList

Implemented Interfaces:
BoundedCollection, Collection, List, Serializable

public class FixedSizeList
extends AbstractSerializableListDecorator
implements BoundedCollection

Decorates another 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.

Version:
$Revision: 1.8 $ $Date: 2004/06/03 22:02:13 $
Authors:
Stephen Colebourne
Paul Jack
Since:
Commons Collections 3.0

Field Summary

Fields inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator

collection

Constructor Summary

FixedSizeList(List list)
Constructor that wraps (not copies).

Method Summary

boolean
add(Object object)
void
add(int index, 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()
Iterator
iterator()
int
lastIndexOf(Object object)
ListIterator
listIterator()
ListIterator
listIterator(int index)
int
maxSize()
boolean
remove(Object object)
Object
remove(int index)
boolean
removeAll(Collection coll)
boolean
retainAll(Collection coll)
Object
set(int index, Object object)
List
subList(int fromIndex, int toIndex)

Methods inherited from class org.apache.commons.collections.list.AbstractListDecorator

add, addAll, get, getList, indexOf, lastIndexOf, listIterator, listIterator, remove, set, subList

Methods inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator

add, addAll, clear, contains, containsAll, equals, getCollection, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString

Constructor Details

FixedSizeList

protected FixedSizeList(List list)
Constructor that wraps (not copies).
Parameters:
list - the list to decorate, must not be null

Method Details

add

public boolean add(Object object)
Overrides:
add in interface AbstractCollectionDecorator

add

public void add(int index,
                Object object)
Overrides:
add in interface AbstractListDecorator

addAll

public boolean addAll(Collection coll)
Overrides:
addAll in interface AbstractCollectionDecorator

addAll

public boolean addAll(int index,
                      Collection coll)
Overrides:
addAll in interface AbstractListDecorator

clear

public void clear()
Overrides:
clear in interface AbstractCollectionDecorator

decorate

public static List decorate(List list)
Factory method to create a fixed size list.
Parameters:
list - the list to decorate, must not be null

get

public Object get(int index)
Overrides:
get in interface AbstractListDecorator

indexOf

public int indexOf(Object object)
Overrides:
indexOf in interface AbstractListDecorator

isFull

public boolean isFull()
Specified by:
isFull in interface BoundedCollection

iterator

public Iterator iterator()
Overrides:
iterator in interface AbstractCollectionDecorator

lastIndexOf

public int lastIndexOf(Object object)
Overrides:
lastIndexOf in interface AbstractListDecorator

listIterator

public ListIterator listIterator()
Overrides:
listIterator in interface AbstractListDecorator

listIterator

public ListIterator listIterator(int index)
Overrides:
listIterator in interface AbstractListDecorator

maxSize

public int maxSize()
Specified by:
maxSize in interface BoundedCollection

remove

public boolean remove(Object object)
Overrides:
remove in interface AbstractCollectionDecorator

remove

public Object remove(int index)
Overrides:
remove in interface AbstractListDecorator

removeAll

public boolean removeAll(Collection coll)
Overrides:
removeAll in interface AbstractCollectionDecorator

retainAll

public boolean retainAll(Collection coll)
Overrides:
retainAll in interface AbstractCollectionDecorator

set

public Object set(int index,
                  Object object)
Overrides:
set in interface AbstractListDecorator

subList

public List subList(int fromIndex,
                    int toIndex)
Overrides:
subList in interface AbstractListDecorator

Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.