com.ls.util.container
Class OrderedHashtable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--com.ls.util.container.OrderedHashtable
All Implemented Interfaces:
Cloneable, Map, Serializable

public class OrderedHashtable
extends Hashtable

This class is same as normal hashtable, but keeping the order of the inserting objects. It is used by the class com.ls.util javaToXMLConverter.

Version:
$Revision: 1.2 $
Author:
Last modified by $Author: TBerk $
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
Map.Entry
 
Field Summary
protected  Vector keyVector
          to keep order of the hashtable key
 
Constructor Summary
OrderedHashtable()
          Constructs a new, empty OrderedHashtable, so that it create vector for storing the keys of the hashtable
 
Method Summary
 boolean isEmpty()
          Tests if this hashtable maps no keys to values.
 Enumeration keys()
          Returns an enumeration of the keys in this hashtable..
 Iterator keysIterator()
          Returns an iterator over the keys of the Hashtable in proper sequence.
 Object put(Object key, Object value)
          Maps the specified key to the specified value in this hashtable.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, keySet, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

keyVector

protected Vector keyVector
to keep order of the hashtable key
Constructor Detail

OrderedHashtable

public OrderedHashtable()
Constructs a new, empty OrderedHashtable, so that it create vector for storing the keys of the hashtable
Method Detail

isEmpty

public boolean isEmpty()
Tests if this hashtable maps no keys to values.
Overrides:
isEmpty in class Hashtable
Returns:
true if this hashtable maps no keys to values; false otherwise.

keys

public Enumeration keys()
Returns an enumeration of the keys in this hashtable.. The returned Enumeration object will generate from all keys in this Hashtable. The first object generated is the key, which intserted at first, and then second and so on.
Overrides:
keys in class Hashtable
Returns:
an enumeration of the keys in this hashtable.

keysIterator

public Iterator keysIterator()
Returns an iterator over the keys of the Hashtable in proper sequence.
Returns:
an iterator over the elements in this list in proper sequence.

put

public Object put(Object key,
                  Object value)
           throws NullPointerException
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.

Overrides:
put in class Hashtable
Parameters:
key - the hashtable key.
value - the value.
Returns:
the previous value of the specified key in this hashtable, or null if it did not have one.
Throws:
NullPointerException - If the key or value is null.