public class IntHashSet
extends java.lang.Object
| Constructor and Description |
|---|
IntHashSet()
Constructs an empty HashSet with the default initial
capacity (16) and the default load factor (0.75).
|
IntHashSet(int initialCapacity,
float loadFactor)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int key)
Adds the specified element to this set if it is not already present.
|
boolean |
contains(int key)
Returns true if this set contains the specified element.
|
boolean |
remove(int key)
Removes the specified element from this set if it is present.
|
int |
size()
Returns the number of elements in this set.
|
int[] |
toArray()
Returns the elements as an array.
|
public IntHashSet()
public IntHashSet(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity.loadFactor - the load factor.public boolean contains(int key)
public boolean add(int key)
public boolean remove(int key)
public int size()
public int[] toArray()