|
APTCONVERT 1.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.pixware.util.LinearHashtable
public final class LinearHashtable
A hashtable which is more compact and less efficient (modulo the fact that
java.util.Hashtable is thread safe and that LinearHashtable is not
thread safe) than Hashtable
.
LinearHashtable has exactly the same API as java.util.Hashtable, therefore there is no need to document again this API here.
This implementation is the one used by Smalltalk. It is useful if you need to have hundreds or even thousands of very small hashtables (with up to 3 entries for most instances).
Constructor Summary | |
---|---|
LinearHashtable()
Constructs a hashtable with an initial capacity of 3 key/value pairs. |
|
LinearHashtable(int capacity)
Constructs a hashtable with the specified initial capacity. |
Method Summary | |
---|---|
void |
clear()
|
java.lang.Object |
clone()
|
boolean |
contains(java.lang.Object value)
|
boolean |
containsKey(java.lang.Object key)
|
void |
copyElementsInto(java.lang.Object[] array)
Copies the elements contained into this hashtable into the specified array. |
void |
copyKeysInto(java.lang.Object[] array)
Copies the keys contained into this hashtable into the specified array. |
java.util.Enumeration |
elements()
|
java.lang.Object |
get(java.lang.Object key)
|
boolean |
isEmpty()
|
java.util.Enumeration |
keys()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
Returns the number of key/value pairs currently stored in this hashtable. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LinearHashtable()
public LinearHashtable(int capacity)
capacity
- the initial capcity expressed in number of key/value
pairsMethod Detail |
---|
public int size()
Hashtable.size()
because the size is recomputed each
time this method is called.
public boolean isEmpty()
public boolean contains(java.lang.Object value)
public boolean containsKey(java.lang.Object key)
public java.lang.Object get(java.lang.Object key)
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
public java.lang.Object remove(java.lang.Object key)
public void clear()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void copyKeysInto(java.lang.Object[] array)
array
- the array where the keys are to be copiedpublic void copyElementsInto(java.lang.Object[] array)
array
- the array where the elements are to be copiedpublic java.util.Enumeration keys()
public java.util.Enumeration elements()
|
APTCONVERT 1.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |