|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.util.LookupTable
public class LookupTable
A kind of hashtable (maps keys to values), useful for a limited number of elements.
Field Summary | |
---|---|
static int |
DEFAULT_CAPACITY
The default capacity. |
Constructor Summary | |
---|---|
LookupTable()
Constructor, build a LookupTable with a initial capacity set to DEFAULT_CAPACITY. |
|
LookupTable(int capacity)
Constructor. |
Method Summary | |
---|---|
void |
clear()
Clears this lookuptable so that it contains no keys. |
java.lang.Object |
clone()
Creates a shallow copy of this lookuptable. |
boolean |
contains(java.lang.Object value)
Tests if some key maps into the specified value in this lookuptable. |
boolean |
containsKey(java.lang.Object key)
Tests if the specified object is a key in this lookuptable. |
java.util.Enumeration |
elements()
Returns an enumeration of the values in this lookuptable. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which the specified key is mapped in this lookuptable. |
protected void |
grow()
Increases the capacity. |
boolean |
isEmpty()
Tests if this lookuptable maps no keys to values. |
java.util.Enumeration |
keys()
Returns an enumeration of the keys in this lookuptable. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Maps the specified key to the specified
value in this lookuptable. |
java.lang.Object |
remove(java.lang.Object key)
Removes the key (and its corresponding value) from this lookuptable. |
int |
size()
Returns the number of keys in this lookuptable. |
java.lang.String |
toString()
Returns a string representation of this Lookuptable object in the form of a set of entries, enclosed in braces and separated by the ASCII characters ", " (comma and space). |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CAPACITY
Constructor Detail |
---|
public LookupTable(int capacity)
capacity
- the initial capacitypublic LookupTable()
Method Detail |
---|
public int size()
public boolean isEmpty()
true
if this lookuptable maps no keys to values;
false
otherwise.public java.util.Enumeration keys()
Enumeration
,
elements()
public java.util.Enumeration elements()
Enumeration
,
keys()
public boolean contains(java.lang.Object value)
value
- a value to search for.
true
if and only if some key maps to the
value
argument in this lookuptable as
determined by the equals method;
false
otherwise.
java.lang.NullPointerException
- if the value is null
.containsKey(Object)
public boolean containsKey(java.lang.Object key)
key
- possible key.
true
if and only if the specified object
is a key in this lookuptable, as determined by the
equals method; false
otherwise.contains(Object)
public java.lang.Object get(java.lang.Object key)
key
- a key in the lookuptable.
null
if the key is not mapped to any value in
this lookuptable.put(Object, Object)
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
key
to the specified
value
in this lookuptable. 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 lookuptable key.value
- the value.
null
if it did not have one.
java.lang.NullPointerException
- if the key or value is
null
.Object.equals(Object)
,
get(Object)
protected void grow()
public java.lang.Object 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()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
Overrides to toString method of Object.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |