org.exolab.castor.util

Class OrderedHashMap

public class OrderedHashMap extends 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.

Version: $Revision: 6230 $ $Date: 2005-12-13 14:58:48 -0700 (Tue, 13 Dec 2005) $

Author: Keith Visco

Constructor Summary
OrderedHashMap()
Creates a new OrderedHashMap
OrderedHashMap(int initialCapacity)
Creates a new OrderedHashMap with the given initial capacity
OrderedHashMap(Map m)
Creates a new OrderedHashMap with the same entries as the given map.
Method Summary
voidclear()
Objectclone()
SetentrySet()
Returns the Map.Entry set for this Map.
SetkeySet()
Returns the key set for this Map.
Objectput(Object key, Object value)
voidputAll(Map m)
Objectremove(Object key)
Collectionvalues()
Returns the set of values for this Map.

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(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()

See Also: java.util.Map#clear()

clone

public Object clone()

See Also: java.lang.Object#clone()

entrySet

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

See Also: java.util.Map#entrySet()

keySet

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

See Also: java.util.Map#keySet()

put

public Object put(Object key, Object value)

See Also: java.util.Map#put(java.lang.Object, java.lang.Object)

putAll

public void putAll(Map m)

See Also: java.util.Map#putAll(java.util.Map)

remove

public Object remove(Object key)

See Also: java.util.Map#remove(java.lang.Object)

values

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

See Also: java.util.Map#values()

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