|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
org.apache.turbine.util.SequencedHashtable
A Hashtable
whose keys are sequenced. The
sequencing of the keys allow easy access to the values in the order
which they were added in. This class is thread safe.
Implementing the List interface is not possible due to a instance method name clash between the Collection and the List interface:
Collections | boolean remove(Object o) |
Lists | Object remove(Object o) |
A slightly more complex implementation and interface could involve
the use of a list of Map.Entry
objects.
Constructor Summary | |
SequencedHashtable()
Deprecated. Creates a new instance with default storage. |
|
SequencedHashtable(int size)
Deprecated. Creates a new instance with the specified storage. |
Method Summary | |
void |
clear()
Deprecated. Clears all elements. |
java.lang.Object |
clone()
Deprecated. Creates a shallow copy of this object, preserving the internal structure by copying only references. |
protected void |
freshenSequence(java.lang.Object key,
java.lang.Object value)
Deprecated. Freshens the sequence of the element value if
value is not null . |
java.lang.Object |
get(int index)
Deprecated. Returns the key at the specified index. |
java.lang.Object |
getValue(int index)
Deprecated. Returns the value at the specified index. |
int |
indexOf(java.lang.Object key)
Deprecated. Returns the index of the specified key. |
java.util.Iterator |
iterator()
Deprecated. Returns a key iterator. |
int |
lastIndexOf(java.lang.Object key)
Deprecated. Returns the last index of the specified key. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Deprecated. Stores the provided key/value pair. |
void |
putAll(java.util.Map t)
Deprecated. Stores the provided key/value pairs. |
java.lang.Object |
remove(int index)
Deprecated. Removes the element at the specified index. |
java.lang.Object |
remove(java.lang.Object key)
Deprecated. Removes the element with the specified key. |
java.util.List |
sequence()
Deprecated. Returns the ordered sequence of keys. |
java.util.Collection |
values()
Deprecated. Slightly cheaper implementation of values() method. |
Methods inherited from class java.util.Hashtable |
contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, rehash, size, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SequencedHashtable()
public SequencedHashtable(int size)
size
- The storage to allocate up front.Method Detail |
public void clear()
public java.lang.Object clone()
clone()
'd.
public java.lang.Object get(int index)
public java.lang.Object getValue(int index)
public int indexOf(java.lang.Object key)
public java.util.Iterator iterator()
public int lastIndexOf(java.lang.Object key)
public java.util.List sequence()
## $table contains a sequenced hashtable #foreach ($key in $table.sequence()) <TR> <TD>Key: $key</TD> </TD>Value: $table.get($key)</TD> </TR> #end
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
key
- The key to the provided value.value
- The value to store.
null
if none.protected void freshenSequence(java.lang.Object key, java.lang.Object value)
value
if
value
is not null
.
key
- The key whose sequence to freshen.value
- The value whose existance to check before removing the old
key sequence.public void putAll(java.util.Map t)
t
- The key/value pairs to store.public java.lang.Object remove(int index)
index
- The index of the object to remove.
key
, or
null
if none existed.public java.lang.Object remove(java.lang.Object key)
key
- The Map
key of the object to remove.
key
, or
null
if none existed.public java.util.Collection values()
values()
method.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |