org.jfree.util

Class ObjectList

Implemented Interfaces:
Cloneable, Serializable

public class ObjectList
extends AbstractObjectList

A list of objects that can grow as required.

When cloning, the objects in the list are NOT cloned, only the references.

Author:
Thomas Morgner

Field Summary

Fields inherited from class org.jfree.util.AbstractObjectList

DEFAULT_INITIAL_CAPACITY

Constructor Summary

ObjectList()
Default constructor.
ObjectList(int initialCapacity)
Creates a new list.

Method Summary

Object
get(int index)
Returns the object at the specified index, if there is one, or null.
int
indexOf(Object object)
Returns the index of the specified object, or -1 if the object is not in the list.
void
set(int index, Object object)
Sets an object reference (overwriting any existing object).

Methods inherited from class org.jfree.util.AbstractObjectList

clear, clone, equals, get, hashCode, indexOf, set, size

Constructor Details

ObjectList

public ObjectList()
Default constructor.

ObjectList

public ObjectList(int initialCapacity)
Creates a new list.
Parameters:
initialCapacity - the initial capacity.

Method Details

get

public Object get(int index)
Returns the object at the specified index, if there is one, or null.
Overrides:
get in interface AbstractObjectList
Parameters:
index - the object index.
Returns:
The object or null.

indexOf

public int indexOf(Object object)
Returns the index of the specified object, or -1 if the object is not in the list.
Overrides:
indexOf in interface AbstractObjectList
Parameters:
object - the object.
Returns:
The index or -1.

set

public void set(int index,
                Object object)
Sets an object reference (overwriting any existing object).
Overrides:
set in interface AbstractObjectList
Parameters:
index - the object index.
object - the object (null permitted).