1
/* ========================================================================
2
* JCommon : a free general purpose class library for the Java(tm) platform
3
* ========================================================================
5
* (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
7
* Project Info: http://www.jfree.org/jcommon/index.html
9
* This library is free software; you can redistribute it and/or modify it
10
* under the terms of the GNU Lesser General Public License as published by
11
* the Free Software Foundation; either version 2.1 of the License, or
12
* (at your option) any later version.
14
* This library is distributed in the hope that it will be useful, but
15
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17
* License for more details.
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25
* in the United States and other countries.]
30
* (C)opyright 2003, 2004, by Object Refinery Limited and Contributors.
32
* Original Author: David Gilbert (for Object Refinery Limited);
35
* $Id: ObjectList.java,v 1.6 2005/11/14 10:56:42 mungady Exp $
39
* 17-Jul-2003 : Version 1 (DG);
40
* 13-Aug-2003 : Refactored to extend AbstractObjectList (DG);
41
* 21-Oct-2004 : removed duplicate interface declarations and empty methods.
42
* 22-Oct-2004 : Restored removed methods - see note in code (DG);
46
package org.jfree.util;
50
* A list of objects that can grow as required.
52
* When cloning, the objects in the list are NOT cloned, only the references.
54
* @author Thomas Morgner
56
public class ObjectList extends AbstractObjectList {
59
* Default constructor.
67
* @param initialCapacity the initial capacity.
69
public ObjectList(final int initialCapacity) {
70
super(initialCapacity);
73
// NOTE: the methods below look redundant, but their purpose is to provide public
74
// access to the the get(), set() and indexOf() methods defined in the
75
// AbstractObjectList class, for this class only. For other classes
76
// (e.g. PaintList, ShapeList etc) we don't want the Object versions of these
77
// methods to be visible in the public API.
80
* Returns the object at the specified index, if there is one, or <code>null</code>.
82
* @param index the object index.
84
* @return The object or <code>null</code>.
86
public Object get(final int index) {
87
return super.get(index);
91
* Sets an object reference (overwriting any existing object).
93
* @param index the object index.
94
* @param object the object (<code>null</code> permitted).
96
public void set(final int index, final Object object) {
97
super.set(index, object);
101
* Returns the index of the specified object, or -1 if the object is not in the list.
103
* @param object the object.
105
* @return The index or -1.
107
public int indexOf(final Object object) {
108
return super.indexOf(object);