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 {@code Boolean} objects. 033 */ 034public class BooleanList extends AbstractObjectList { 035 036 /** For serialization. */ 037 private static final long serialVersionUID = -8543170333219422042L; 038 039 /** 040 * Creates a new list. 041 */ 042 public BooleanList() { 043 } 044 045 /** 046 * Returns a {@link Boolean} from the list. 047 * 048 * @param index the index (zero-based). 049 * 050 * @return a {@link Boolean} from the list. 051 */ 052 public Boolean getBoolean(int index) { 053 return (Boolean) get(index); 054 } 055 056 /** 057 * Sets the value for an item in the list. The list is expanded if 058 * necessary. 059 * 060 * @param index the index (zero-based). 061 * @param b the boolean. 062 */ 063 public void setBoolean(int index, Boolean b) { 064 set(index, b); 065 } 066 067 /** 068 * Tests the list for equality with another object (typically also a list). 069 * 070 * @param o the other object. 071 * 072 * @return A boolean. 073 */ 074 @Override 075 public boolean equals(Object o) { 076 if (o instanceof BooleanList) { 077 return super.equals(o); 078 } 079 return false; 080 } 081 082 /** 083 * Returns a hash code value for the object. 084 * 085 * @return the hashcode 086 */ 087 @Override 088 public int hashCode() { 089 return super.hashCode(); 090 } 091} 092