java.util
Class RegularEnumSet
- class RegularEnumSet
- extends java.util.EnumSet
- Private implementation class for EnumSet, for "regular sized" enum types (i.e., those with 64 or fewer enum constants).
- Author:
- Josh Bloch
- Since:
- 1.5
elements
private long elements
- Bit vector representation of this set. The 2^k bit indicates the presence of universe[k] in this set.
iterator
public java.util.Iterator iterator()
- Returns an iterator over the elements contained in this set. The iterator traverses the elements in their natural order (which is the order in which the enum constants are declared). The returned Iterator is a "snapshot" iterator that will never throw ConcurrentModificationException; the elements are traversed as they existed when this call was invoked.
- Returns:
- an iterator over the elements contained in this set
size
public int size()
- Returns the number of elements in this set.
- Returns:
- the number of elements in this set
isEmpty
public boolean isEmpty()
- Returns true if this set contains no elements.
- Returns:
- true if this set contains no elements
contains
public boolean contains(java.lang.Object e)
- Returns true if this set contains the specified element.
- Parameters:
e
- element to be checked for containment in this collection
- Returns:
- true if this set contains the specified element
add
public boolean add(E e)
- Adds the specified element to this set if it is not already present.
- Parameters:
e
- element to be added to this set
- Returns:
- true if the set changed as a result of the call
- Throws:
NullPointerException
- if e is null
remove
public boolean remove(java.lang.Object e)
- Removes the specified element from this set if it is present.
- Parameters:
e
- element to be removed from this set, if present
- Returns:
- true if the set contained the specified element
containsAll
public boolean containsAll(java.util.Collection c)
- Returns true if this set contains all of the elements in the specified collection.
- Parameters:
c
- collection to be checked for containment in this set
- Returns:
- true if this set contains all of the elements in the specified collection
- Throws:
NullPointerException
- if the specified collection is null
addAll
public boolean addAll(java.util.Collection c)
- Adds all of the elements in the specified collection to this set.
- Parameters:
c
- collection whose elements are to be added to this set
- Returns:
- true if this set changed as a result of the call
- Throws:
NullPointerException
- if the specified collection or any of its elements.
removeAll
public boolean removeAll(java.util.Collection c)
- Removes from this set all of its elements that are contained in the specified collection.
- Parameters:
c
- elements to be removed from this set
- Returns:
- true if this set changed as a result of the call
- Throws:
NullPointerException
- if the specified collection is null
retainAll
public boolean retainAll(java.util.Collection c)
- Retains only the elements in this set that are contained in the specified collection.
- Parameters:
c
- elements to be retained in this set
- Returns:
- true if this set changed as a result of the call
- Throws:
NullPointerException
- if the specified collection is null
clear
public void clear()
- Removes all of the elements from this set.
equals
public boolean equals(java.lang.Object o)
- Compares the specified object with this set for equality. Returns true 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 this set.
- Parameters:
e
- object to be compared for equality with this set
- Returns:
- true if the specified object is equal to this set