public class CharArrayCache
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
char[][] |
keyTable |
int[] |
valueTable |
| Constructor and Description |
|---|
CharArrayCache()
Constructs a new, empty hashtable.
|
CharArrayCache(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(char[] key)
Returns true if the collection contains an element for the key.
|
int |
get(char[] key)
Gets the object associated with the specified key in the
hashtable.
|
int |
putIfAbsent(char[] key,
int value)
Puts the specified element into the hashtable if it wasn't there already,
using the specified key.
|
void |
remove(char[] key)
Remove the object associated with the specified key in the
hashtable.
|
char[] |
returnKeyFor(int value)
Returns the key corresponding to the value.
|
int |
size()
Returns the number of elements contained in the hashtable.
|
java.lang.String |
toString()
Converts to a rather lengthy String.
|
public CharArrayCache()
public CharArrayCache(int initialCapacity)
initialCapacity - int
the initial number of buckets; must be less than Integer.MAX_VALUE / 2public void clear()
public boolean containsKey(char[] key)
key - char[] the key that we are looking forpublic int get(char[] key)
key - char[] the specified keypublic int putIfAbsent(char[] key,
int value)
key - the given key in the hashtablevalue - the given valuepublic void remove(char[] key)
key - char[] the specified keypublic char[] returnKeyFor(int value)
value - int the value that we are looking forpublic int size()
int The size of the tablepublic java.lang.String toString()
toString in class java.lang.Object