public class IntegerCache
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
int[] |
keyTable |
int[] |
valueTable |
| Constructor and Description |
|---|
IntegerCache()
Constructs a new, empty hashtable.
|
IntegerCache(int initialCapacity)
Constructs a new, empty hashtable with the specified initial
capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the hash table so that it has no more elements in it.
|
boolean |
containsKey(int key)
Returns true if the collection contains an element for the key.
|
int |
hash(int key)
Return a hashcode for the value of the key parameter.
|
int |
put(int key,
int value)
Puts the specified element into the hashtable, using the specified
key.
|
int |
putIfAbsent(int key,
int value)
Puts the specified element into the hashtable if absent, using the specified
key.
|
int |
size()
Returns the number of elements contained in the hashtable.
|
java.lang.String |
toString()
Converts to a rather lengthy String.
|
public IntegerCache()
public IntegerCache(int initialCapacity)
initialCapacity - int
the initial number of bucketspublic void clear()
public boolean containsKey(int key)
key - double the key that we are looking forpublic int hash(int key)
key - intpublic int put(int key,
int value)
key - int the specified key in the hashtablevalue - int the specified elementpublic int putIfAbsent(int key,
int value)
key - int the specified key in the hashtablevalue - int the specified elementpublic int size()
int The size of the tablepublic java.lang.String toString()
toString in class java.lang.Object