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

private Object
element

Constructor Summary

SingletonList(Object element)
Creates a new singleton list.

Method Summary

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

Field Details

element

private final Object element

Constructor Details

SingletonList

public SingletonList(Object element)
Creates a new singleton list.
Parameters:
element - the single member of the list

Method Details

get

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

size

public int size()
Returns 1.
Returns:
1