org.jaxen.util

Class SingletonList

public class SingletonList extends AbstractList

A utility class that implements singleton lists (to avoid dependency on JDK 1.3). Many operations including add() and remove() throw UnsupportedOperationExceptions.

Version: 1.2b12

Author: Attila Szegedi

Field Summary
Objectelement
Constructor Summary
SingletonList(Object element)
Creates a new singleton list.
Method Summary
Objectget(int index)
Returns the single element in the list.
intsize()
Returns 1.

Field Detail

element

private final Object element

Constructor Detail

SingletonList

public SingletonList(Object element)
Creates a new singleton list.

Parameters: element the single member of the list

Method Detail

get

public Object get(int index)
Returns the single element in the list.

Returns: the only element in the list

Throws: IndexOutOfBoundsException if index is not 0

size

public int size()
Returns 1.

Returns: 1