|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.collections.IntHashSet
public class IntHashSet
A Set or primitive int. Implemented as a HashMap of int->int. *
Constructor Summary | |
---|---|
IntHashSet()
Constructs a map with default capacity. |
|
IntHashSet(int capacity)
Constructs a map with given capacity. |
Method Summary | |
---|---|
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. |
void |
printBaseHash()
Prints the baseHash array, used for debug purposes. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IntHashSet()
public IntHashSet(int capacity)
capacity
- minimum capacity for the map.Method Detail |
---|
protected int calcBaseHashIndex(int key)
hashFactor
.
key
- public void clear()
public boolean contains(int value)
value
- that is checked against the map data.
protected int find(int key)
key
-
protected void grow()
public boolean isEmpty()
public IntIterator iterator()
public void printBaseHash()
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 value
public boolean remove(int value)
value
- specify the value to be removed
public 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()
toString
in class Object
public String toHashString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |