| java.lang.Object org.apache.tomcat.util.collections.SimpleHashtable
SimpleHashtable | final public class SimpleHashtable implements Enumeration(Code) | | This class implements a special purpose hashtable. It works like a
normal java.util.Hashtable except that:
- Keys to "get" are strings which are known to be interned,
so that "==" is used instead of "String.equals". (Interning
could be document-relative instead of global.)
- It's not synchronized, since it's to be used only by
one thread at a time.
- The keys () enumerator allocates no memory, with live
updates to the data disallowed.
- It's got fewer bells and whistles: fixed threshold and
load factor, no JDK 1.2 collection support, only keys can be
enumerated, things can't be removed, simpler inheritance; more.
The overall result is that it's less expensive to use these in
performance-critical locations, in terms both of CPU and memory,
than java.util.Hashtable instances. In this package
it makes a significant difference when normalizing attributes,
which is done for each start-element construct.
|
Constructor Summary | |
public | SimpleHashtable(int initialCapacity) Constructs a new, empty hashtable with the specified initial
capacity. | public | SimpleHashtable() Constructs a new, empty hashtable with a default capacity. |
Method Summary | |
public void | clear() | public Object | get(String key) Returns the value to which the specified key is mapped in this
hashtable ... | public Object | getInterned(String key) Returns the value to which the specified key is mapped in this hashtable. | public boolean | hasMoreElements() Used to view this as an enumeration; returns true if there
are more keys to be enumerated. | public Enumeration | keys() Returns an enumeration of the keys in this hashtable. | public Object | nextElement() Used to view this as an enumeration; returns the next key
in the enumeration. | public Object | put(Object key, Object value) Maps the specified key to the specified
value in this hashtable. | public Object | remove(Object key) | public int | size() Returns the number of keys in this hashtable. |
SimpleHashtable | public SimpleHashtable(int initialCapacity)(Code) | | Constructs a new, empty hashtable with the specified initial
capacity.
Parameters: initialCapacity - the initial capacity of the hashtable. |
SimpleHashtable | public SimpleHashtable()(Code) | | Constructs a new, empty hashtable with a default capacity.
|
clear | public void clear()(Code) | | |
get | public Object get(String key)(Code) | | Returns the value to which the specified key is mapped in this
hashtable ... the key isn't necessarily interned, though.
|
getInterned | public Object getInterned(String key)(Code) | | Returns the value to which the specified key is mapped in this hashtable.
|
hasMoreElements | public boolean hasMoreElements()(Code) | | Used to view this as an enumeration; returns true if there
are more keys to be enumerated.
|
keys | public Enumeration keys()(Code) | | Returns an enumeration of the keys in this hashtable.
an enumeration of the keys in this hashtable. See Also: Enumeration |
nextElement | public Object nextElement()(Code) | | Used to view this as an enumeration; returns the next key
in the enumeration.
|
put | public Object put(Object key, Object value)(Code) | | Maps the specified 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.
|
size | public int size()(Code) | | Returns the number of keys in this hashtable.
the number of keys in this hashtable. |
|
|