org.exolab.castor.util
Class OrderedHashMap

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byorg.exolab.castor.util.OrderedHashMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class OrderedHashMap
extends java.util.HashMap

A very simple extended HashMap, which maintains order via an ArrayList. This class provides similar, though not identical, functionality as the JDK's LinkedHashMap, but works under JDK 1.2 and JDK 1.3. This class is not synchronized, if more than one thread accesses an instance of this class and at least one thread modifies the map, the OrderedHashMap instance must be synchronized via a call to Collections.synchronizedMap method. The #entrySet() and #keySet() methods return unmodifiable sets. The #values() method returns an unmodifiable collection.

Author:
Keith Visco
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.HashMap
 
Nested classes inherited from class java.util.AbstractMap
 
Field Summary
 
Fields inherited from class java.util.HashMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
OrderedHashMap()
          Creates a new OrderedHashMap
OrderedHashMap(int initialCapacity)
          Creates a new OrderedHashMap with the given initial capacity
OrderedHashMap(java.util.Map m)
          Creates a new OrderedHashMap with the same entries as the given map.
 
Method Summary
 void clear()
           
 java.lang.Object clone()
           
 java.util.Set entrySet()
          Returns the Map.Entry set for this Map.
 java.util.Set keySet()
          Returns the key set for this Map.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map m)
           
 java.lang.Object remove(java.lang.Object key)
           
 java.util.Collection values()
          Returns the set of values for this Map.
 
Methods inherited from class java.util.HashMap
containsKey, containsValue, get, isEmpty, size
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

OrderedHashMap

public OrderedHashMap()
Creates a new OrderedHashMap


OrderedHashMap

public OrderedHashMap(int initialCapacity)
Creates a new OrderedHashMap with the given initial capacity

Parameters:
initialCapacity -

OrderedHashMap

public OrderedHashMap(java.util.Map m)
Creates a new OrderedHashMap with the same entries as the given map.

Parameters:
m - the Map to initialize this Map with
Method Detail

clear

public void clear()

clone

public java.lang.Object clone()

entrySet

public java.util.Set entrySet()
Returns the Map.Entry set for this Map. Note that the returned Set is an unmodifiable Set

See Also:
Map.entrySet()

keySet

public java.util.Set keySet()
Returns the key set for this Map. Note that the returned set is an unmodifiable Set

See Also:
Map.keySet()

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

putAll

public void putAll(java.util.Map m)

remove

public java.lang.Object remove(java.lang.Object key)

values

public java.util.Collection values()
Returns the set of values for this Map. Note that the returned Collection is unmodifiable.

See Also:
Map.values()


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com