com.caucho.util
Class HashMapImpl<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by com.caucho.util.HashMapImpl<K,V>
All Implemented Interfaces:
java.util.Map<K,V>

public class HashMapImpl<K,V>
extends java.util.AbstractMap<K,V>

HashMap which doesn't allocate a new DeployController per item.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
HashMapImpl()
          Create the hash map impl with a specific capacity.
HashMapImpl(int initialCapacity)
          Create the hash map impl with a specific capacity.
 
Method Summary
 void clear()
          Clears the cache
 java.util.Set<java.util.Map.Entry<K,V>> entrySet()
          Returns the entry set of the cache
 V get(java.lang.Object key)
          Get an item from the cache and make it most recently used.
 java.util.Set<K> keySet()
          Returns the entry set of the cache
 V put(K key, V value)
          Puts a new item in the cache.
 V remove(java.lang.Object key)
          Removes an item from the cache
 int size()
          Returns the current number of entries in the cache.
 
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, putAll, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HashMapImpl

public HashMapImpl()
Create the hash map impl with a specific capacity.

Parameters:
initialCapacity - minimum capacity of the cache

HashMapImpl

public HashMapImpl(int initialCapacity)
Create the hash map impl with a specific capacity.

Parameters:
initialCapacity - minimum capacity of the cache
Method Detail

size

public int size()
Returns the current number of entries in the cache.

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

clear

public void clear()
Clears the cache

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

get

public V get(java.lang.Object key)
Get an item from the cache and make it most recently used.

Specified by:
get in interface java.util.Map<K,V>
Overrides:
get in class java.util.AbstractMap<K,V>
Parameters:
key - key to lookup the item
Returns:
the matching object in the cache

put

public V put(K key,
             V value)
Puts a new item in the cache.

Specified by:
put in interface java.util.Map<K,V>
Overrides:
put in class java.util.AbstractMap<K,V>
Parameters:
key - key to store data
value - value to be stored
Returns:
old value stored under the key

remove

public V remove(java.lang.Object key)
Removes an item from the cache

Specified by:
remove in interface java.util.Map<K,V>
Overrides:
remove in class java.util.AbstractMap<K,V>
Parameters:
key - the key to remove
Returns:
the value removed

keySet

public java.util.Set<K> keySet()
Returns the entry set of the cache

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

entrySet

public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Returns the entry set of the cache

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