public class IntHashSet extends Object
Constructor and Description |
---|
IntHashSet()
Constructs a map with default capacity.
|
IntHashSet(int capacity)
Constructs a map with given capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(int value)
Add a mapping int key -> int value.
|
protected int |
calcBaseHashIndex(int key)
Calculating the baseHash index using the internal
hashFactor
. |
void |
clear()
Empties the map.
|
boolean |
contains(int value)
Checks if a given key exists in the map.
|
protected int |
find(int key)
Find the actual index of a given key.
|
protected void |
grow()
Grows the map.
|
boolean |
isEmpty() |
IntIterator |
iterator()
Returns a new iterator for the mapped objects.
|
boolean |
remove(int value)
Remove a pair from the map, specified by it's key.
|
int |
size() |
int[] |
toArray()
Translates the mapped pairs' values into an array of Objects
|
int[] |
toArray(int[] a)
Translates the mapped pairs' values into an array of ints
|
String |
toHashString() |
String |
toString()
I have no idea why would anyone call it - but for debug purposes.
Prints the entire map, including the index, key, object, next and prev. |
public IntHashSet()
public IntHashSet(int capacity)
capacity
- minimum capacity for the map.protected int calcBaseHashIndex(int key)
hashFactor
.public void clear()
public boolean contains(int value)
value
- that is checked against the map data.protected int find(int key)
protected void grow()
public boolean isEmpty()
public IntIterator iterator()
public boolean add(int value)
If the key was already inside just updating the value it refers to as the given object.
Otherwise if the map is full, first grow()
the map.
value
- integer which maps the given valuepublic boolean remove(int value)
value
- specify the value to be removedpublic int size()
public int[] toArray()
public int[] toArray(int[] a)
a
- the array into which the elements of the map are to be stored,
if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose.public String toString()
public String toHashString()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.