| java.util.Set<E> |
Known Indirect Subclasses
AbstractSet<E>,
CopyOnWriteArraySet<E>,
EnumSet<E extends Enum<E>>,
HashSet<E>,
LinkedHashSet<E>,
SortedSet<E>,
TreeSet<E>
|
Set is a collection which does not allow duplicate elements.
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Adds the specified object to this Set.
| |||||||||||
Adds the objects in the specified Collection which do not exist in this
Set.
| |||||||||||
Removes all elements from this Set, leaving it empty.
| |||||||||||
Searches this Set for the specified object.
| |||||||||||
Searches this Set for all objects in the specified Collection.
| |||||||||||
Compares the argument to the receiver, and returns true if they represent
the same object using a class specific comparison.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Returns if this Set has no elements, a size of zero.
| |||||||||||
Returns an Iterator on the elements of this Set.
| |||||||||||
Removes any occurrence of the specified object from this Set.
| |||||||||||
Removes all objects in the specified Collection from this Set.
| |||||||||||
Removes all objects from this Set that are not contained in the specified
Collection.
| |||||||||||
Returns the number of elements in this Set.
| |||||||||||
Returns an array containing all elements contained in this Set.
| |||||||||||
Returns an array containing all elements contained in this Set.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface java.lang.Iterable
| |||||||||||
From interface java.util.Collection
| |||||||||||
Adds the specified object to this Set. The Set is not modified if it already contains the object.
| object | the object to add |
|---|
| UnsupportedOperationException | when adding to this Set is not supported |
|---|---|
| ClassCastException | when the class of the object is inappropriate for this Set |
| IllegalArgumentException | when the object cannot be added to this Set |
Adds the objects in the specified Collection which do not exist in this Set.
| collection | the Collection of objects |
|---|
| UnsupportedOperationException | when adding to this Set is not supported |
|---|---|
| ClassCastException | when the class of an object is inappropriate for this Set |
| IllegalArgumentException | when an object cannot be added to this Set |
Removes all elements from this Set, leaving it empty.
| UnsupportedOperationException | when removing from this Set is not supported |
|---|
Searches this Set for the specified object.
| object | the object to search for |
|---|
Searches this Set for all objects in the specified Collection.
| collection | the Collection of objects |
|---|
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
| object | Object the object to compare with this object. |
|---|
true if the object is the same as this
object false if it is different from this object.Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.
Returns if this Set has no elements, a size of zero.
Returns an Iterator on the elements of this Set.
Removes any occurrence of the specified object from this Set.
| object | the object to remove |
|---|
| UnsupportedOperationException | when removing from this Set is not supported |
|---|
Removes all objects in the specified Collection from this Set.
| collection | the Collection of objects to remove |
|---|
| UnsupportedOperationException | when removing from this Set is not supported |
|---|
Removes all objects from this Set that are not contained in the specified Collection.
| collection | the Collection of objects to retain |
|---|
| UnsupportedOperationException | when removing from this Set is not supported |
|---|
Returns the number of elements in this Set.
Returns an array containing all elements contained in this Set. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this Set, the array element following the collection elements is set to null.
| array | the array |
|---|
| ArrayStoreException | when the type of an element in this Set cannot be stored in the type of the specified array |
|---|
Returns an array containing all elements contained in this Set.