001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-present, by David Gilbert and Contributors. 006 * 007 * Project Info: http://www.jfree.org/jfreechart/index.html 008 * 009 * This library is free software; you can redistribute it and/or modify it 010 * under the terms of the GNU Lesser General Public License as published by 011 * the Free Software Foundation; either version 2.1 of the License, or 012 * (at your option) any later version. 013 * 014 * This library is distributed in the hope that it will be useful, but 015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 017 * License for more details. 018 * 019 * You should have received a copy of the GNU Lesser General Public 020 * License along with this library; if not, write to the Free Software 021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 022 * USA. 023 * 024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 025 * Other names may be trademarks of their respective owners.] 026 * 027 * --------------- 028 * ObjectList.java 029 * --------------- 030 * (C) Copyright 2000-present, by David Gilbert and Contributors. 031 * 032 * Original Author: David Gilbert; 033 * Contributors: -; 034 */ 035 036package org.jfree.chart.util; 037 038/** 039 * A list of objects that can grow as required. 040 * <p> 041 * When cloning, the objects in the list are NOT cloned, only the references. 042 */ 043public class ObjectList extends AbstractObjectList { 044 045 /** 046 * Default constructor. 047 */ 048 public ObjectList() { 049 } 050 051 /** 052 * Creates a new list. 053 * 054 * @param initialCapacity the initial capacity. 055 */ 056 public ObjectList(int initialCapacity) { 057 super(initialCapacity); 058 } 059 060 // NOTE: the methods below look redundant, but their purpose is to provide public 061 // access to the the get(), set() and indexOf() methods defined in the 062 // AbstractObjectList class, for this class only. For other classes 063 // (e.g. PaintList, ShapeList etc) we don't want the Object versions of these 064 // methods to be visible in the public API. 065 066 /** 067 * Returns the object at the specified index, if there is one, or {@code null}. 068 * 069 * @param index the object index. 070 * 071 * @return The object or {@code null}. 072 */ 073 @Override 074 public Object get(int index) { 075 return super.get(index); 076 } 077 078 /** 079 * Sets an object reference (overwriting any existing object). 080 * 081 * @param index the object index. 082 * @param object the object ({@code null} permitted). 083 */ 084 @Override 085 public void set(int index, Object object) { 086 super.set(index, object); 087 } 088 089 /** 090 * Returns the index of the specified object, or -1 if the object is not in the list. 091 * 092 * @param object the object. 093 * 094 * @return The index or -1. 095 */ 096 @Override 097 public int indexOf(Object object) { 098 return super.indexOf(object); 099 } 100 101}