java.util
Class HashMap<K,V>

java.lang.Object
  extended by java.util.HashMap<K,V>
All Implemented Interfaces:
Map<K,V>

Deprecated. Current implementation is inefficient. Don't use it if your care about performance. Will be replaced with efficient implementation.

@Deprecated
public class HashMap<K,V>
extends Object
implements Map<K,V>

Author:
Michael Mirwaldt

Nested Class Summary
static class HashMap.Entry<K,V>
          Deprecated.  
 
Constructor Summary
HashMap()
          Deprecated.  
HashMap(int arrayListSize)
          Deprecated.  
HashMap(Map<K,V> m)
          Deprecated.  
HashMap(Map<K,V> m, int arrayListSize)
          Deprecated.  
 
Method Summary
 void clear()
          Deprecated. Removes all mappings from this map (optional operation).
 boolean containsKey(Object key)
          Deprecated. Returns true if this map contains a mapping for the specified key.
 boolean containsValue(Object value)
          Deprecated. Returns true if this map maps one or more keys to the specified value.
 Set<Map.Entry<K,V>> entrySet()
          Deprecated. Returns a set view of the mappings contained in this map.
 boolean equals(Object o)
          Deprecated. Compares the specified object with this map for equality.
 V get(Object key)
          Deprecated. Returns the value to which this map maps the specified key.
 int hashCode()
          Deprecated. Returns the hash code value for this map.
 boolean isEmpty()
          Deprecated. Returns true if this map contains no key-value mappings.
 Set<K> keySet()
          Deprecated. Returns a set view of the keys contained in this map.
 V put(K key, V value)
          Deprecated. Associates the specified value with the specified key in this map (optional operation).
 void putAll(Map<? extends K,? extends V> t)
          Deprecated. Copies all of the mappings from the specified map to this map (optional operation).
 V remove(Object key)
          Deprecated. Removes the mapping for this key from this map if it is present (optional operation).
 int size()
          Deprecated. Returns the number of key-value mappings in this map.
 Collection<V> values()
          Deprecated. Returns a collection view of the values contained in this map.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashMap

public HashMap()
Deprecated. 

HashMap

public HashMap(int arrayListSize)
Deprecated. 
Parameters:
arrayListSize - size for array list

HashMap

public HashMap(Map<K,V> m)
Deprecated. 

HashMap

public HashMap(Map<K,V> m,
               int arrayListSize)
Deprecated. 
Method Detail

clear

public void clear()
Deprecated. 
Description copied from interface: Map
Removes all mappings from this map (optional operation).

Specified by:
clear in interface Map<K,V>

containsKey

public boolean containsKey(Object key)
Deprecated. 
Description copied from interface: Map
Returns true if this map contains a mapping for the specified key.

Specified by:
containsKey in interface Map<K,V>

containsValue

public boolean containsValue(Object value)
Deprecated. 
Description copied from interface: Map
Returns true if this map maps one or more keys to the specified value.

Specified by:
containsValue in interface Map<K,V>

entrySet

public Set<Map.Entry<K,V>> entrySet()
Deprecated. 
Description copied from interface: Map
Returns a set view of the mappings contained in this map.

Specified by:
entrySet in interface Map<K,V>

get

public V get(Object key)
Deprecated. 
Description copied from interface: Map
Returns the value to which this map maps the specified key.

Specified by:
get in interface Map<K,V>

isEmpty

public boolean isEmpty()
Deprecated. 
Description copied from interface: Map
Returns true if this map contains no key-value mappings.

Specified by:
isEmpty in interface Map<K,V>

keySet

public Set<K> keySet()
Deprecated. 
Description copied from interface: Map
Returns a set view of the keys contained in this map.

Specified by:
keySet in interface Map<K,V>

put

public V put(K key,
             V value)
Deprecated. 
Description copied from interface: Map
Associates the specified value with the specified key in this map (optional operation).

Specified by:
put in interface Map<K,V>

putAll

public void putAll(Map<? extends K,? extends V> t)
Deprecated. 
Description copied from interface: Map
Copies all of the mappings from the specified map to this map (optional operation).

Specified by:
putAll in interface Map<K,V>

remove

public V remove(Object key)
Deprecated. 
Description copied from interface: Map
Removes the mapping for this key from this map if it is present (optional operation).

Specified by:
remove in interface Map<K,V>

size

public int size()
Deprecated. 
Description copied from interface: Map
Returns the number of key-value mappings in this map.

Specified by:
size in interface Map<K,V>

values

public Collection<V> values()
Deprecated. 
Description copied from interface: Map
Returns a collection view of the values contained in this map.

Specified by:
values in interface Map<K,V>

equals

public boolean equals(Object o)
Deprecated. 
Compares the specified object with this map for equality. Returns true if the given object is also a map and the two maps represent the same mappings. More formally, two maps m1 and m2 represent the same mappings if m1.entrySet().equals(m2.entrySet()). This ensures that the equals method works properly across different implementations of the Map interface.

This implementation first checks if the specified object is this map; if so it returns true. Then, it checks if the specified object is a map whose size is identical to the size of this map; if not, it returns false. If so, it iterates over this map's entrySet collection, and checks that the specified map contains each mapping that this map contains. If the specified map fails to contain such a mapping, false is returned. If the iteration completes, true is returned.

Specified by:
equals in interface Map<K,V>
Overrides:
equals in class Object
Parameters:
o - object to be compared for equality with this map
Returns:
true if the specified object is equal to this map

hashCode

public int hashCode()
Deprecated. 
Returns the hash code value for this map. The hash code of a map is defined to be the sum of the hash codes of each entry in the map's entrySet() view. This ensures that m1.equals(m2) implies that m1.hashCode()==m2.hashCode() for any two maps m1 and m2, as required by the general contract of Object.hashCode().

This implementation iterates over entrySet(), calling hashCode() on each element (entry) in the set, and adding up the results.

Specified by:
hashCode in interface Map<K,V>
Overrides:
hashCode in class Object
Returns:
the hash code value for this map
See Also:
HashMap.Entry.hashCode(), Object.equals(Object), Set.equals(Object)