⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.list

Class FixedSizeList

java.lang.Object
|
+--org.apache.commons.collections.collection.AbstractCollectionDecorator
   |
   +--org.apache.commons.collections.list.AbstractListDecorator
      |
      +--org.apache.commons.collections.list.FixedSizeList

All Implemented Interfaces:
Collection, List, BoundedCollection


public class FixedSizeList
extends AbstractListDecorator
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).

Since:
Commons Collections 3.0
Authors:
Stephen Colebourne
Paul Jack

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()

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)

Constructor Details

FixedSizeList

protected FixedSizeList(List list)

Constructor that wraps (not copies).

Parameters:
list - the list to decorate, must not be null
Throws:
- if list is null

Method Details

add

public void add(int index, Object object)

Parameters:
index
object

add

public boolean add(Object object)

Parameters:
object

addAll

public boolean addAll(Collection coll)

Parameters:
coll

addAll

public boolean addAll(int index, Collection coll)

Parameters:
index
coll

clear

public void clear()


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
Throws:
- if list is null

get

public Object get(int index)

Parameters:
index

indexOf

public int indexOf(Object object)

Parameters:
object

isFull

public boolean isFull()


iterator

public Iterator iterator()


lastIndexOf

public int lastIndexOf(Object object)

Parameters:
object

listIterator

public ListIterator listIterator()


listIterator

public ListIterator listIterator(int index)

Parameters:
index

maxSize

public int maxSize()


remove

public Object remove(int index)

Parameters:
index

remove

public boolean remove(Object object)

Parameters:
object

removeAll

public boolean removeAll(Collection coll)

Parameters:
coll

retainAll

public boolean retainAll(Collection coll)

Parameters:
coll

set

public Object set(int index, Object object)

Parameters:
index
object

subList

public List subList(int fromIndex, int toIndex)

Parameters:
fromIndex
toIndex