JumboEnumSet.java revision 3758
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * Private implementation class for EnumSet, for "jumbo" enum types * (i.e., those with more than 64 elements). * Bit vector representation of this set. The ith bit of the jth * element of this array represents the presence of universe[64*j +i] // Redundant - maintained for performance * Returns an iterator over the elements contained in this set. The * iterator traverses the elements in their <i>natural order</i> (which is * the order in which the enum constants are declared). The returned * Iterator is a "weakly consistent" iterator that will never throw {@link * ConcurrentModificationException}. * @return an iterator over the elements contained in this set * A bit vector representing the elements in the current "word" * of the set not yet returned by this iterator. * The index corresponding to unseen in the elements array. * The bit representing the last element returned by this iterator * but not removed, or zero if no such element exists. * The index corresponding to lastReturned in the elements array. * Returns the number of elements in this set. * @return the number of elements in this set * Returns <tt>true</tt> if this set contains no elements. * @return <tt>true</tt> if this set contains no elements * Returns <tt>true</tt> if this set contains the specified element. * @param e element to be checked for containment in this collection * @return <tt>true</tt> if this set contains the specified element // Modification Operations * Adds the specified element to this set if it is not already present. * @param e element to be added to this set * @return <tt>true</tt> if the set changed as a result of the call * @throws NullPointerException if <tt>e</tt> is null public boolean add(E e) {
* Removes the specified element from this set if it is present. * @param e element to be removed from this set, if present * @return <tt>true</tt> if the set contained the specified element * Returns <tt>true</tt> if this set contains all of the elements * in the specified collection. * @param c collection to be checked for containment in this set * @return <tt>true</tt> if this set contains all of the elements * in the specified collection * @throws NullPointerException if the specified collection is null * Adds all of the elements in the specified collection to this set. * @param c collection whose elements are to be added to this set * @return <tt>true</tt> if this set changed as a result of the call * @throws NullPointerException if the specified collection or any of * Removes from this set all of its elements that are contained in * the specified collection. * @param c elements to be removed from this set * @return <tt>true</tt> if this set changed as a result of the call * @throws NullPointerException if the specified collection is null * Retains only the elements in this set that are contained in the * @param c elements to be retained in this set * @return <tt>true</tt> if this set changed as a result of the call * @throws NullPointerException if the specified collection is null * Removes all of the elements from this set. * Compares the specified object with this set for equality. Returns * <tt>true</tt> if the given object is also a set, the two sets have * the same size, and every member of the given set is contained in * @param e object to be compared for equality with this set * @return <tt>true</tt> if the specified object is equal to this set * Recalculates the size of the set. Returns true if it's changed.