org.jfree.util

Class AbstractObjectList

public class AbstractObjectList extends Object implements Cloneable, Serializable

A list of objects that can grow as required.

Author: David Gilbert

Field Summary
static intDEFAULT_INITIAL_CAPACITY
The default initial capacity of the list.
Constructor Summary
protected AbstractObjectList()
Creates a new list with the default initial capacity.
protected AbstractObjectList(int initialCapacity)
Creates a new list.
protected AbstractObjectList(int initialCapacity, int increment)
Creates a new list.
Method Summary
voidclear()
Clears the list.
Objectclone()
Clones the list of objects.
booleanequals(Object obj)
Tests this list for equality with another object.
protected Objectget(int index)
Returns the object at the specified index, if there is one, or null.
inthashCode()
Returns a hash code value for the object.
protected intindexOf(Object object)
Returns the index of the specified object, or -1 if the object is not in the list.
protected voidset(int index, Object object)
Sets an object reference (overwriting any existing object).
intsize()
Returns the size of the list.

Field Detail

DEFAULT_INITIAL_CAPACITY

public static final int DEFAULT_INITIAL_CAPACITY
The default initial capacity of the list.

Constructor Detail

AbstractObjectList

protected AbstractObjectList()
Creates a new list with the default initial capacity.

AbstractObjectList

protected AbstractObjectList(int initialCapacity)
Creates a new list.

Parameters: initialCapacity the initial capacity.

AbstractObjectList

protected AbstractObjectList(int initialCapacity, int increment)
Creates a new list.

Parameters: initialCapacity the initial capacity. increment the increment.

Method Detail

clear

public void clear()
Clears the list.

clone

public Object clone()
Clones the list of objects. The objects in the list are not cloned, so this is method makes a 'shallow' copy of the list.

Returns: A clone.

Throws: CloneNotSupportedException if an item in the list does not support cloning.

equals

public boolean equals(Object obj)
Tests this list for equality with another object.

Parameters: obj the object to test.

Returns: A boolean.

get

protected Object get(int index)
Returns the object at the specified index, if there is one, or null.

Parameters: index the object index.

Returns: The object or null.

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns: the hashcode

indexOf

protected int indexOf(Object object)
Returns the index of the specified object, or -1 if the object is not in the list.

Parameters: object the object.

Returns: The index or -1.

set

protected void set(int index, Object object)
Sets an object reference (overwriting any existing object).

Parameters: index the object index. object the object (null permitted).

size

public int size()
Returns the size of the list.

Returns: The size of the list.