001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-2017, by Object Refinery Limited 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 029package org.jfree.chart.util; 030 031/** 032 * A list of objects that can grow as required. 033 * <p> 034 * When cloning, the objects in the list are NOT cloned, only the references. 035 */ 036public class ObjectList extends AbstractObjectList { 037 038 /** 039 * Default constructor. 040 */ 041 public ObjectList() { 042 } 043 044 /** 045 * Creates a new list. 046 * 047 * @param initialCapacity the initial capacity. 048 */ 049 public ObjectList(int initialCapacity) { 050 super(initialCapacity); 051 } 052 053 // NOTE: the methods below look redundant, but their purpose is to provide public 054 // access to the the get(), set() and indexOf() methods defined in the 055 // AbstractObjectList class, for this class only. For other classes 056 // (e.g. PaintList, ShapeList etc) we don't want the Object versions of these 057 // methods to be visible in the public API. 058 059 /** 060 * Returns the object at the specified index, if there is one, or {@code null}. 061 * 062 * @param index the object index. 063 * 064 * @return The object or {@code null}. 065 */ 066 @Override 067 public Object get(int index) { 068 return super.get(index); 069 } 070 071 /** 072 * Sets an object reference (overwriting any existing object). 073 * 074 * @param index the object index. 075 * @param object the object ({@code null} permitted). 076 */ 077 @Override 078 public void set(int index, Object object) { 079 super.set(index, object); 080 } 081 082 /** 083 * Returns the index of the specified object, or -1 if the object is not in the list. 084 * 085 * @param object the object. 086 * 087 * @return The index or -1. 088 */ 089 @Override 090 public int indexOf(Object object) { 091 return super.indexOf(object); 092 } 093 094}