DthingApi
Public Member Functions | List of all members
java.util.Set< E > Interface Template Reference
Inheritance diagram for java.util.Set< E >:
java.util.Collection< E > java.util.AbstractSet< E > java.util.HashSet< E > java.util.HashSet< E >

Public Member Functions

boolean add (E object)
 
boolean addAll (Collection<? extends E > collection)
 
void clear ()
 
boolean contains (Object object)
 
boolean containsAll (Collection<?> collection)
 
boolean equals (Object object)
 
int hashCode ()
 
boolean isEmpty ()
 
Iterator< E > iterator ()
 
boolean remove (Object object)
 
boolean removeAll (Collection<?> collection)
 
boolean retainAll (Collection<?> collection)
 
int size ()
 
Object [] toArray ()
 

Detailed Description

A

Set

is a data structure which does not allow duplicate elements.

Since
1.2

Member Function Documentation

◆ add()

boolean java.util.Set< E >.add ( object)

Adds the specified object to this set. The set is not modified if it already contains the object.

Parameters
objectthe object to add.
Returns
true
if this set is modified,
false
otherwise.
Exceptions
UnsupportedOperationExceptionwhen adding to this set is not supported.
ClassCastExceptionwhen the class of the object is inappropriate for this set.
IllegalArgumentExceptionwhen the object cannot be added to this set.

Implements java.util.Collection< E >.

Implemented in java.util.HashSet< E >.

◆ addAll()

boolean java.util.Set< E >.addAll ( Collection<? extends E >  collection)

Adds the objects in the specified collection which do not exist yet in this set.

Parameters
collectionthe collection of objects.
Returns
true
if this set is modified,
false
otherwise.
Exceptions
UnsupportedOperationExceptionwhen adding to this set is not supported.
ClassCastExceptionwhen the class of an object is inappropriate for this set.
IllegalArgumentExceptionwhen an object cannot be added to this set.

Implements java.util.Collection< E >.

◆ clear()

void java.util.Set< E >.clear ( )

Removes all elements from this set, leaving it empty.

Exceptions
UnsupportedOperationExceptionwhen removing from this set is not supported.
See also
isEmpty
size

Implements java.util.Collection< E >.

Implemented in java.util.HashSet< E >.

◆ contains()

boolean java.util.Set< E >.contains ( Object  object)

Searches this set for the specified object.

Parameters
objectthe object to search for.
Returns
true
if object is an element of this set,
false
otherwise.

Implements java.util.Collection< E >.

Implemented in java.util.HashSet< E >.

◆ containsAll()

boolean java.util.Set< E >.containsAll ( Collection<?>  collection)

Searches this set for all objects in the specified collection.

Parameters
collectionthe collection of objects.
Returns
true
if all objects in the specified collection are elements of this set,
false
otherwise.

Implements java.util.Collection< E >.

◆ equals()

boolean java.util.Set< E >.equals ( Object  object)

Compares the specified object to this set, and returns true if they represent the same object using a class specific comparison. Equality for a set means that both sets have the same size and the same elements.

Parameters
objectthe object to compare with this object.
Returns
boolean
true
if the object is the same as this object, and
false
if it is different from this object.
See also
hashCode

Implements java.util.Collection< E >.

Implemented in java.util.AbstractSet< E >.

◆ hashCode()

int java.util.Set< E >.hashCode ( )

Returns the hash code for this set. Two set which are equal must return the same value.

Returns
the hash code of this set.
See also
equals

Implements java.util.Collection< E >.

Implemented in java.util.AbstractSet< E >.

◆ isEmpty()

boolean java.util.Set< E >.isEmpty ( )

Returns true if this set has no elements.

Returns
true
if this set has no elements,
false
otherwise.
See also
size

Implements java.util.Collection< E >.

Implemented in java.util.HashSet< E >.

◆ iterator()

Iterator<E> java.util.Set< E >.iterator ( )

Returns an iterator on the elements of this set. The elements are unordered.

Returns
an iterator on the elements of this set.
See also
Iterator

Implements java.util.Collection< E >.

Implemented in java.util.HashSet< E >.

◆ remove()

boolean java.util.Set< E >.remove ( Object  object)

Removes the specified object from this set.

Parameters
objectthe object to remove.
Returns
true
if this set was modified,
false
otherwise.
Exceptions
UnsupportedOperationExceptionwhen removing from this set is not supported.

Implements java.util.Collection< E >.

Implemented in java.util.HashSet< E >.

◆ removeAll()

boolean java.util.Set< E >.removeAll ( Collection<?>  collection)

Removes all objects in the specified collection from this set.

Parameters
collectionthe collection of objects to remove.
Returns
true
if this set was modified,
false
otherwise.
Exceptions
UnsupportedOperationExceptionwhen removing from this set is not supported.

Implements java.util.Collection< E >.

Implemented in java.util.AbstractSet< E >.

◆ retainAll()

boolean java.util.Set< E >.retainAll ( Collection<?>  collection)

Removes all objects from this set that are not contained in the specified collection.

Parameters
collectionthe collection of objects to retain.
Returns
true
if this set was modified,
false
otherwise.
Exceptions
UnsupportedOperationExceptionwhen removing from this set is not supported.

Implements java.util.Collection< E >.

◆ size()

int java.util.Set< E >.size ( )

Returns the number of elements in this set.

Returns
the number of elements in this set.

Implements java.util.Collection< E >.

Implemented in java.util.HashSet< E >.

◆ toArray()

Object [] java.util.Set< E >.toArray ( )

Returns an array containing all elements contained in this set.

Returns
an array of the elements from this set.

Implements java.util.Collection< E >.


The documentation for this interface was generated from the following file: