|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
ariba.util.core.Hashtable
ariba.util.core.OrderedHashtable
public class OrderedHashtable
An OrderedHashtable is just like a normal Hashtable except that it remembers the order the keys were added to the table and, whenever keys() or elements() is called, they are returned in that order.
Just overrides all the appropriate methods in Hashtable.
Adds only one method reverseKeys(), which is the same as keys(), but the
Enumeration is in the reverse order.
Note:: Because this an ordered collection, its performances maybe not be as good as an ordinary Hashtable. Use it only when the order of entry matters
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
OrderedHashtable()
|
Method Summary | |
---|---|
void |
clear()
Removes all keys and elements from the Hashtable. |
java.lang.Object |
clone()
Creates a shallow copy of the OrderedHashtable. |
java.util.Enumeration |
elements()
Returns an Enumeration of the Hashtable's elements. |
int |
indexOfKey(java.lang.Object key)
|
void |
insertElementAt(java.lang.Object key,
java.lang.Object value,
int index)
|
java.util.Enumeration |
keys()
Returns an Enumeration of the Hashtable's keys. |
java.util.Set |
keySet()
Returns a Set view of the keys contained in this map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Places the key/element pair in the Hashtable. |
java.lang.Object |
remove(java.lang.Object key)
Finds and removes key and the element associated with it from the Hashtable. |
int |
removeElement(java.lang.Object element)
Finds and removes all occurrences of element from the Hashtable. |
java.lang.Object |
removeElementAt(int index)
|
java.util.Enumeration |
reverseKeys()
|
void |
setElementAt(java.lang.Object key,
java.lang.Object value,
int index)
Set the element which is the key/value pair in this OrderedHashtable at a given index. |
java.util.Collection |
values()
Returns a collection view of the values contained in this map. |
Methods inherited from class ariba.util.core.Hashtable |
---|
contains, containsKey, count, elementsArray, elementsVector, entrySet, fromSerializedString, get, isEmpty, keysArray, keysVector, readExternal, size, toSerializedString, toString, toStringArray, writeExternal |
Methods inherited from class java.util.AbstractMap |
---|
containsValue, equals, hashCode, putAll |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OrderedHashtable()
Method Detail |
---|
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
Hashtable
put
in interface java.util.Map
put
in class Hashtable
key
- the key to place into the Hashtable; may not be
nullvalue
- the element to place into the Hashtable; may
not be null
public void clear()
Hashtable
clear
in interface java.util.Map
clear
in class Hashtable
public java.lang.Object remove(java.lang.Object key)
Hashtable
remove
in interface java.util.Map
remove
in class Hashtable
key
- the key to search the hashtable's keys
for. Hashtable hashes and compares key using
hashCode() and equals().
public int removeElement(java.lang.Object element)
Hashtable
removeElement
in class Hashtable
element
- the element to search for. Hashtable compares elements
using equals().
MapUtil.removeElement(java.util.Map, java.lang.Object)
public java.util.Enumeration keys()
Hashtable
keys
in class Hashtable
Hashtable.keySet
,
Set.iterator()
,
Hashtable.elements()
public java.util.Enumeration elements()
Hashtable
elements
in class Hashtable
Hashtable.values
,
Collection.iterator()
,
Hashtable.keys()
public java.lang.Object clone()
clone
in class Hashtable
java.lang.InternalError
- if the cloning operation fails.public java.util.Set keySet()
keySet
in interface java.util.Map
keySet
in class Hashtable
public java.util.Collection values()
values
in interface java.util.Map
values
in class Hashtable
public java.util.Enumeration reverseKeys()
public void insertElementAt(java.lang.Object key, java.lang.Object value, int index)
public void setElementAt(java.lang.Object key, java.lang.Object value, int index)
key
- the key to be setvalue
- the value associated with keyindex
- the order of this key-value pairpublic java.lang.Object removeElementAt(int index)
public int indexOfKey(java.lang.Object key)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |