|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Set is a collection which does not allow duplicate elements.
Method Summary | |
boolean |
add(java.lang.Object object)
Adds the specified object to this Set. |
boolean |
addAll(Collection collection)
Adds the objects in the specified Collection which do not exist in this Set. |
void |
clear()
Removes all elements from this Set, leaving it empty. |
boolean |
contains(java.lang.Object object)
Searches this Set for the specified object. |
boolean |
containsAll(Collection collection)
Searches this Set for all objects in the specified Collection. |
boolean |
equals(java.lang.Object object)
Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. |
int |
hashCode()
Answers an integer hash code for the receiver. |
boolean |
isEmpty()
Answers if this Set has no elements, a size of zero. |
Iterator |
iterator()
Answers an Iterator on the elements of this Set. |
boolean |
remove(java.lang.Object object)
Removes any occurrence of the specified object from this Set. |
boolean |
removeAll(Collection collection)
Removes all objects in the specified Collection from this Set. |
boolean |
retainAll(Collection collection)
Removes all objects from this Set that are not contained in the specified Collection. |
int |
size()
Answers the number of elements in this Set. |
java.lang.Object[] |
toArray()
Answers an array containing all elements contained in this Set. |
java.lang.Object[] |
toArray(java.lang.Object[] array)
Answers an array containing all elements contained in this Set. |
Method Detail |
public boolean add(java.lang.Object object)
add
in interface Collection
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 Setpublic boolean addAll(Collection collection)
addAll
in interface Collection
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 Setpublic void clear()
clear
in interface Collection
UnsupportedOperationException
- when removing from this Set is not supportedisEmpty()
,
size()
public boolean contains(java.lang.Object object)
contains
in interface Collection
object
- the object to search for
public boolean containsAll(Collection collection)
containsAll
in interface Collection
collection
- the Collection of objects
public boolean equals(java.lang.Object object)
equals
in interface Collection
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.hashCode()
public int hashCode()
hashCode
in interface Collection
equals(java.lang.Object)
public boolean isEmpty()
isEmpty
in interface Collection
size()
public Iterator iterator()
iterator
in interface Collection
Iterator
public boolean remove(java.lang.Object object)
remove
in interface Collection
object
- the object to remove
UnsupportedOperationException
- when removing from this Set is not supportedpublic boolean removeAll(Collection collection)
removeAll
in interface Collection
collection
- the Collection of objects to remove
UnsupportedOperationException
- when removing from this Set is not supportedpublic boolean retainAll(Collection collection)
retainAll
in interface Collection
collection
- the Collection of objects to retain
UnsupportedOperationException
- when removing from this Set is not supportedpublic int size()
size
in interface Collection
public java.lang.Object[] toArray()
toArray
in interface Collection
public java.lang.Object[] toArray(java.lang.Object[] array)
toArray
in interface Collection
array
- the array
ArrayStoreException
- when the type of an element in this Set cannot be stored
in the type of the specified array
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |