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

Public Member Functions

 HashSet ()
 
 HashSet (int capacity)
 
 HashSet (int capacity, float loadFactor)
 
 HashSet (Collection<? extends E > collection)
 
boolean add (E object)
 
void clear ()
 
Object clone ()
 
boolean contains (Object object)
 
boolean isEmpty ()
 
Iterator< E > iterator ()
 
boolean remove (Object object)
 
int size ()
 
- Public Member Functions inherited from java.util.AbstractSet< E >
boolean equals (Object object)
 
int hashCode ()
 
boolean removeAll (Collection<?> collection)
 
- Public Member Functions inherited from java.util.AbstractCollection< E >
boolean add (E object)
 
boolean addAll (Collection<? extends E > collection)
 
void clear ()
 
boolean contains (Object object)
 
boolean containsAll (Collection<?> collection)
 
boolean isEmpty ()
 
abstract Iterator< E > iterator ()
 
boolean remove (Object object)
 
boolean removeAll (Collection<?> collection)
 
boolean retainAll (Collection<?> collection)
 
abstract int size ()
 
Object [] toArray ()
 
String toString ()
 
- Public Member Functions inherited from java.util.Set< E >
boolean addAll (Collection<? extends E > collection)
 
boolean containsAll (Collection<?> collection)
 
boolean retainAll (Collection<?> collection)
 
Object [] toArray ()
 

Additional Inherited Members

- Protected Member Functions inherited from java.util.AbstractSet< E >
 AbstractSet ()
 
- Protected Member Functions inherited from java.util.AbstractCollection< E >
 AbstractCollection ()
 

Detailed Description

HashSet is an implementation of a Set. All optional operations (adding and removing) are supported. The elements can be any objects.

Constructor & Destructor Documentation

◆ HashSet() [1/4]

java.util.HashSet< E >.HashSet ( )
inline

Constructs a new empty instance of

.

◆ HashSet() [2/4]

java.util.HashSet< E >.HashSet ( int  capacity)
inline

Constructs a new instance of

with the specified capacity.

Parameters
capacitythe initial capacity of this .

◆ HashSet() [3/4]

java.util.HashSet< E >.HashSet ( int  capacity,
float  loadFactor 
)
inline

Constructs a new instance of

with the specified capacity and load factor.

Parameters
capacitythe initial capacity.
loadFactorthe initial load factor.

◆ HashSet() [4/4]

java.util.HashSet< E >.HashSet ( Collection<? extends E >  collection)
inline

Constructs a new instance of

containing the unique elements in the specified collection.

Parameters
collectionthe collection of elements to add.

Member Function Documentation

◆ add()

boolean java.util.HashSet< E >.add ( object)
inline

Adds the specified object to this

if not already present.

Parameters
objectthe object to add.
Returns
true
when this did not already contain the object,
false
otherwise

Implements java.util.Set< E >.

◆ clear()

void java.util.HashSet< E >.clear ( )
inline

Removes all elements from this

, leaving it empty.

See also
isEmpty
size

Implements java.util.Set< E >.

◆ clone()

Object java.util.HashSet< E >.clone ( )
inline

Returns a new

with the same elements and size as this

.

Returns
a shallow copy of this .
See also
java.lang.Cloneable

◆ contains()

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

Searches this

for the specified object.

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

Implements java.util.Set< E >.

◆ isEmpty()

boolean java.util.HashSet< E >.isEmpty ( )
inline

Returns true if this

has no elements, false otherwise.

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

Implements java.util.Set< E >.

◆ iterator()

Iterator<E> java.util.HashSet< E >.iterator ( )
inline

Returns an Iterator on the elements of this

.

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

Implements java.util.Set< E >.

◆ remove()

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

Removes the specified object from this

.

Parameters
objectthe object to remove.
Returns
true
if the object was removed,
false
otherwise.

Implements java.util.Set< E >.

◆ size()

int java.util.HashSet< E >.size ( )
inline

Returns the number of elements in this

.

Returns
the number of elements in this .

Implements java.util.Set< E >.


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