felix.util
Class MemoryFriendlyHashMap<K,V>

java.lang.Object
  extended by felix.util.MemoryFriendlyHashMap<K,V>
Type Parameters:
K - the key type
V - the value type
All Implemented Interfaces:
java.io.Serializable, java.util.Map<K,V>

public class MemoryFriendlyHashMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>, java.io.Serializable

A memory-efficient hash map.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
MemoryFriendlyHashMap()
          The constructor.
MemoryFriendlyHashMap(java.util.Map<? extends K,? extends V> m)
          The constructor with a map.
 
Method Summary
 void clear()
          Clears hashmap.
 boolean containsKey(java.lang.Object key)
          Returns true if this hashmap contains the given key.
 boolean containsValue(java.lang.Object value)
          Returns true if this hashmap contains the given value.
 java.util.Set<java.util.Map.Entry<K,V>> entrySet()
          Returns the set of entries for this hashmap.
 boolean equals(java.lang.Object o)
          Returns true if this hashmap equals the given object.
 V get(java.lang.Object key)
          Returns value associated with the given key.
 int hashCode()
           
 boolean isEmpty()
          Returns true if this hashmap is empty.
 java.util.Set<K> keySet()
          Returns the keyset for this hashmap.
 V put(K key, V value)
          Adds the given key-value pair to this hashmap.
 void putAll(java.util.Map<? extends K,? extends V> m)
          Adds all the given key-value pairs to this hashmap.
 V remove(java.lang.Object key)
          Removes the key-value pair associated with the given key and return the value.
 int size()
          Returns the size of this hashmap.
 java.lang.String toString()
          Returns a string representation of this hashmap.
 java.util.Collection<V> values()
          Returns the values in this hashmap.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemoryFriendlyHashMap

public MemoryFriendlyHashMap()
The constructor.


MemoryFriendlyHashMap

public MemoryFriendlyHashMap(java.util.Map<? extends K,? extends V> m)
The constructor with a map.

Parameters:
m -
Method Detail

clear

public void clear()
Clears hashmap.

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

containsKey

public boolean containsKey(java.lang.Object key)
Returns true if this hashmap contains the given key.

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

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if this hashmap contains the given value.

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

entrySet

public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Returns the set of entries for this hashmap.

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

equals

public boolean equals(java.lang.Object o)
Returns true if this hashmap equals the given object.

Specified by:
equals in interface java.util.Map<K,V>
Overrides:
equals in class java.lang.Object

get

public V get(java.lang.Object key)
Returns value associated with the given key.

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

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map<K,V>
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()
Returns true if this hashmap is empty.

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

keySet

public java.util.Set<K> keySet()
Returns the keyset for this hashmap.

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

put

public V put(K key,
             V value)
Adds the given key-value pair to this hashmap.

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

putAll

public void putAll(java.util.Map<? extends K,? extends V> m)
Adds all the given key-value pairs to this hashmap.

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

remove

public V remove(java.lang.Object key)
Removes the key-value pair associated with the given key and return the value.

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

size

public int size()
Returns the size of this hashmap.

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

toString

public java.lang.String toString()
Returns a string representation of this hashmap.

Overrides:
toString in class java.lang.Object

values

public java.util.Collection<V> values()
Returns the values in this hashmap.

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