aicas logoJamaica 3.2 release 62

java.util
Class EnumSet<T extends Enum<T>>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<T>
          extended by java.util.EnumSet<T>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, Set<T>

public class EnumSet<T extends Enum<T>>
extends AbstractSet<T>
implements Cloneable, Serializable

Since:
1.5
See Also:
Serialized Form

Method Summary
 boolean add(T val)
          Add an object to the collection (optional operation).
 boolean addAll(Collection<? extends T> c)
          Add all the elements of a given collection to this collection (optional operation).
static
<T extends Enum<T>>
EnumSet<T>
allOf(Class<T> eltType)
           
 void clear()
          Remove all elements from the collection (optional operation).
 EnumSet<T> clone()
          clone creates a shallow clone of this.
static
<T extends Enum<T>>
EnumSet<T>
complementOf(EnumSet<T> other)
           
 boolean contains(Object o)
          Test whether this collection contains a given object.
 boolean containsAll(Collection<?> c)
          Tests whether this collection contains all the elements in a given collection.
static
<T extends Enum<T>>
EnumSet<T>
copyOf(Collection<T> other)
           
static
<T extends Enum<T>>
EnumSet<T>
copyOf(EnumSet<T> other)
           
 Iterator<T> iterator()
          Return an Iterator over this collection.
static
<T extends Enum<T>>
EnumSet<T>
noneOf(Class<T> eltType)
           
static
<T extends Enum<T>>
EnumSet<T>
of(T first)
           
static
<T extends Enum<T>>
EnumSet<T>
of(T first, T... rest)
           
static
<T extends Enum<T>>
EnumSet<T>
of(T first, T second)
           
static
<T extends Enum<T>>
EnumSet<T>
of(T first, T second, T third)
           
static
<T extends Enum<T>>
EnumSet<T>
of(T first, T second, T third, T fourth)
           
static
<T extends Enum<T>>
EnumSet<T>
of(T first, T second, T third, T fourth, T fifth)
           
static
<T extends Enum<T>>
EnumSet<T>
range(T from, T to)
           
 boolean remove(Object o)
          Remove a single instance of an object from this collection (optional operation).
 boolean removeAll(Collection<?> c)
          Removes from this set all elements in the given collection (optional operation).
 boolean retainAll(Collection<?> c)
          Remove from this collection all its elements that are not contained in a given collection (optional operation).
 int size()
          Return the number of elements in this collection.
 
Methods inherited from class java.util.AbstractSet
equals, hashCode
 
Methods inherited from class java.util.AbstractCollection
isEmpty, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
isEmpty, toArray, toArray
 

Method Detail

clone

public EnumSet<T> clone()
Description copied from class: Object
clone creates a shallow clone of this.

Overrides:
clone in class Object
Returns:
a clone of this object.

size

public int size()
Description copied from class: AbstractCollection
Return the number of elements in this collection. If there are more than Integer.MAX_VALUE elements, return Integer.MAX_VALUE.

Specified by:
size in interface Collection<T extends Enum<T>>
Specified by:
size in interface Set<T extends Enum<T>>
Specified by:
size in class AbstractCollection<T extends Enum<T>>
Returns:
the size

iterator

public Iterator<T> iterator()
Description copied from class: AbstractCollection
Return an Iterator over this collection. The iterator must provide the hasNext and next methods and should in addition provide remove if the collection is modifiable.

Specified by:
iterator in interface Iterable<T extends Enum<T>>
Specified by:
iterator in interface Collection<T extends Enum<T>>
Specified by:
iterator in interface Set<T extends Enum<T>>
Specified by:
iterator in class AbstractCollection<T extends Enum<T>>
Returns:
an iterator

add

public boolean add(T val)
Description copied from class: AbstractCollection
Add an object to the collection (optional operation). This implementation always throws an UnsupportedOperationException - it should be overridden if the collection is to be modifiable. If the collection does not accept duplicates, simply return false. Collections may specify limitations on what may be added.

Specified by:
add in interface Collection<T extends Enum<T>>
Specified by:
add in interface Set<T extends Enum<T>>
Overrides:
add in class AbstractCollection<T extends Enum<T>>
Parameters:
val - the object to add
Returns:
true if the add operation caused the Collection to change

addAll

public boolean addAll(Collection<? extends T> c)
Description copied from class: AbstractCollection
Add all the elements of a given collection to this collection (optional operation). This implementation obtains an Iterator over the given collection and iterates over it, adding each element with the add(Object) method (thus this method will fail with an UnsupportedOperationException if the add method does). The behavior is unspecified if the specified collection is modified during the iteration, including the special case of trying addAll(this) on a non-empty collection.

Specified by:
addAll in interface Collection<T extends Enum<T>>
Specified by:
addAll in interface Set<T extends Enum<T>>
Overrides:
addAll in class AbstractCollection<T extends Enum<T>>
Parameters:
c - the collection to add the elements of to this collection
Returns:
true if the add operation caused the Collection to change
See Also:
AbstractCollection.add(Object)

clear

public void clear()
Description copied from class: AbstractCollection
Remove all elements from the collection (optional operation). This implementation obtains an iterator over the collection and calls next and remove on it repeatedly (thus this method will fail with an UnsupportedOperationException if the Iterator's remove method does) until there are no more elements to remove. Many implementations will have a faster way of doing this.

Specified by:
clear in interface Collection<T extends Enum<T>>
Specified by:
clear in interface Set<T extends Enum<T>>
Overrides:
clear in class AbstractCollection<T extends Enum<T>>
See Also:
Iterator.remove()

contains

public boolean contains(Object o)
Description copied from class: AbstractCollection
Test whether this collection contains a given object. That is, if the collection has an element e such that (o == null ? e == null : o.equals(e)). This implementation obtains an iterator over the collection and iterates over it, testing each element for equality with the given object. If it is equal, true is returned. Otherwise false is returned when the end of the collection is reached.

Specified by:
contains in interface Collection<T extends Enum<T>>
Specified by:
contains in interface Set<T extends Enum<T>>
Overrides:
contains in class AbstractCollection<T extends Enum<T>>
Parameters:
o - the object to remove from this collection
Returns:
true if this collection contains an object equal to o

containsAll

public boolean containsAll(Collection<?> c)
Description copied from class: AbstractCollection
Tests whether this collection contains all the elements in a given collection. This implementation iterates over the given collection, testing whether each element is contained in this collection. If any one is not, false is returned. Otherwise true is returned.

Specified by:
containsAll in interface Collection<T extends Enum<T>>
Specified by:
containsAll in interface Set<T extends Enum<T>>
Overrides:
containsAll in class AbstractCollection<T extends Enum<T>>
Parameters:
c - the collection to test against
Returns:
true if this collection contains all the elements in the given collection
See Also:
AbstractCollection.contains(Object)

remove

public boolean remove(Object o)
Description copied from class: AbstractCollection
Remove a single instance of an object from this collection (optional operation). That is, remove one element e such that (o == null ? e == null : o.equals(e)), if such an element exists. This implementation obtains an iterator over the collection and iterates over it, testing each element for equality with the given object. If it is equal, it is removed by the iterator's remove method (thus this method will fail with an UnsupportedOperationException if the Iterator's remove method does). After the first element has been removed, true is returned; if the end of the collection is reached, false is returned.

Specified by:
remove in interface Collection<T extends Enum<T>>
Specified by:
remove in interface Set<T extends Enum<T>>
Overrides:
remove in class AbstractCollection<T extends Enum<T>>
Parameters:
o - the object to remove from this collection
Returns:
true if the remove operation caused the Collection to change, or equivalently if the collection did contain o.
See Also:
Iterator.remove()

removeAll

public boolean removeAll(Collection<?> c)
Description copied from class: AbstractSet
Removes from this set all elements in the given collection (optional operation). This implementation uses size() to determine the smaller collection. Then, if this set is smaller, it iterates over the set, calling Iterator.remove if the collection contains the element. If this set is larger, it iterates over the collection, calling Set.remove for all elements in the collection. Note that this operation will fail if a remove methods is not supported.

Specified by:
removeAll in interface Collection<T extends Enum<T>>
Specified by:
removeAll in interface Set<T extends Enum<T>>
Overrides:
removeAll in class AbstractSet<T extends Enum<T>>
Parameters:
c - the collection of elements to remove
Returns:
true if the set was modified as a result
See Also:
AbstractCollection.remove(Object), Collection.contains(Object), Iterator.remove()

retainAll

public boolean retainAll(Collection<?> c)
Description copied from class: AbstractCollection
Remove from this collection all its elements that are not contained in a given collection (optional operation). This implementation iterates over this collection, and for each element tests if it is contained in the given collection. If not, it is removed by the Iterator's remove method (thus this method will fail with an UnsupportedOperationException if the Iterator's remove method does).

Specified by:
retainAll in interface Collection<T extends Enum<T>>
Specified by:
retainAll in interface Set<T extends Enum<T>>
Overrides:
retainAll in class AbstractCollection<T extends Enum<T>>
Parameters:
c - the collection to retain the elements of
Returns:
true if the remove operation caused the Collection to change
See Also:
Iterator.remove()

allOf

public static <T extends Enum<T>> EnumSet<T> allOf(Class<T> eltType)

noneOf

public static <T extends Enum<T>> EnumSet<T> noneOf(Class<T> eltType)

copyOf

public static <T extends Enum<T>> EnumSet<T> copyOf(EnumSet<T> other)

copyOf

public static <T extends Enum<T>> EnumSet<T> copyOf(Collection<T> other)

complementOf

public static <T extends Enum<T>> EnumSet<T> complementOf(EnumSet<T> other)

of

public static <T extends Enum<T>> EnumSet<T> of(T first)

of

public static <T extends Enum<T>> EnumSet<T> of(T first,
                                                T second)

of

public static <T extends Enum<T>> EnumSet<T> of(T first,
                                                T second,
                                                T third)

of

public static <T extends Enum<T>> EnumSet<T> of(T first,
                                                T second,
                                                T third,
                                                T fourth)

of

public static <T extends Enum<T>> EnumSet<T> of(T first,
                                                T second,
                                                T third,
                                                T fourth,
                                                T fifth)

of

public static <T extends Enum<T>> EnumSet<T> of(T first,
                                                T... rest)

range

public static <T extends Enum<T>> EnumSet<T> range(T from,
                                                   T to)

aicas logoJamaica 3.2 release 62

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2008 aicas GmbH. All Rights Reserved.