2004.04.29


com.jdc.util
Class HashMapList

java.lang.Object
  |
  +--HashMap
        |
        +--com.jdc.util.HashMapList

public class HashMapList
extends HashMap

HashMapList is a HashMap implementation that also may be accessed like an ArrayList, i.e. in the order items are inserted into the map.

Version:
1.0
Author:
Jay Damon
See Also:
HashMap, ArrayList, Serialized Form

Constructor Summary
HashMapList()
          Constructs a new, empty map with a default capacity and load factor, which is 0.75.
HashMapList(int initialCapacity)
          Constructs a new, empty map with the specified initial capacity and default load factor, which is 0.75.
HashMapList(int initialCapacity, float loadFactor)
          Constructs a new, empty map with the specified initial capacity and the specified load factor.
 
Method Summary
 void clear()
          Removes all mappings from this map.
 Object clone()
          Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned.
 Object get(int index)
          Returns the key element at the specified position in the list.
 Object put(Object key, Object value)
          Associates the specified value with the specified key in this map.
 void putAll(Map map)
          Copies all of the mappings from the specified map to this one.
 Object remove(Object key)
          Removes the mapping for this key from this map if present.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashMapList

public HashMapList()
Constructs a new, empty map with a default capacity and load factor, which is 0.75.


HashMapList

public HashMapList(int initialCapacity)
Constructs a new, empty map with the specified initial capacity and default load factor, which is 0.75.


HashMapList

public HashMapList(int initialCapacity,
                   float loadFactor)
Constructs a new, empty map with the specified initial capacity and the specified load factor.

Method Detail

clear

public void clear()
Removes all mappings from this map.


clone

public Object clone()
Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned. THIS METHOD IS NOT IMPLEMENTED.

Returns:
Object A shallow copy of this map.

get

public Object get(int index)
Returns the key element at the specified position in the list.

Returns:
Object The key element at the specified index,

put

public Object put(Object key,
                  Object value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.

Returns:
Object The previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.

putAll

public void putAll(Map map)
Copies all of the mappings from the specified map to this one. These mappings replace any mappings that this map had for any of the keys currently in the specified Map. THIS METHOD IS NOT IMPLEMENTED.


remove

public Object remove(Object key)
Removes the mapping for this key from this map if present.

Returns:
Object The previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.