|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoodsjpi.Persistent
goodslib.HashTable
Hash table of persistent objects
Field Summary | |
protected int |
count
|
protected float |
loadFactor
|
protected goodslib.HashTableEntry[] |
table
|
protected int |
threshold
|
Fields inherited from class goodsjpi.Persistent |
defaultMetaobject, metaobject |
Constructor Summary | |
HashTable()
Constructs a new, empty hashtable with a default capacity and load factor, which is 0.75. |
|
HashTable(int initialCapacity)
Constructs a new, empty HashTable with the specified initial capacity and default load factor. |
|
HashTable(int initialCapacity,
float loadFactor)
Constructs a new, empty HashTable with the specified initial capacity and the specified load factor. |
Method Summary | |
static int |
canonicalHashCode(java.lang.Object obj)
Different versions of JDK provides different implementations of hashCode() methods for the same classes. |
void |
clear()
Clears this HashTable so that it contains no keys. |
Persistent |
get(java.lang.Object key)
Returns the value to which the specified key is mapped in this HashTable |
Persistent |
put(Persistent key,
Persistent value)
Maps the specified key to the specified
value in this HashTable. |
Persistent |
put(java.lang.String key,
Persistent value)
Associate object with string key. |
protected void |
rehash()
Rehashes the contents of the HashTable into a HashTable with a larger capacity. |
Persistent |
remove(java.lang.Object key)
Removes the key (and its corresponding value) from this HashTable. |
int |
size()
Returns the number of keys in this HashTable. |
Methods inherited from class goodsjpi.Persistent |
attachToStorage, clone, clusterWith, finalize, getDatabase, getOid, getStorageId, hashCode, onLoad |
Methods inherited from class java.lang.Object |
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected goodslib.HashTableEntry[] table
protected int count
protected int threshold
protected float loadFactor
Constructor Detail |
public HashTable(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the HashTable.loadFactor
- a number between 0.0 and 1.0.
java.lang.IllegalArgumentException
- if the initial capacity is less
than or equal to zero, or if the load factor is less than
or equal to zero.public HashTable(int initialCapacity)
initialCapacity
- the initial capacity of the HashTable.public HashTable()
Method Detail |
public int size()
public static int canonicalHashCode(java.lang.Object obj)
public Persistent get(java.lang.Object key)
key
- a key in the HashTable.
null
if the key is not mapped to any value in
this HashTable.protected void rehash()
public Persistent put(Persistent key, Persistent value)
key
to the specified
value
in this HashTable. Neither the key nor the
value can be null
.
The value can be retrieved by calling the get
method
with a key that is equal to the original key.
key
- the HashTable key.value
- the value.
null
if it did not have one.
java.lang.NullPointerException
- if the key or value is
null
.public Persistent put(java.lang.String key, Persistent value)
public Persistent remove(java.lang.Object key)
key
- the key that needs to be removed.
null
if the key did not have a mapping.public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |