net.grinder.util
Class WeakValueHashMap<K,V>

java.lang.Object
  extended by net.grinder.util.WeakValueHashMap<K,V>
Type Parameters:
K - Key type.
V - Value type.

public final class WeakValueHashMap<K,V>
extends Object

A map that maintains weak references to its values.

Author:
Philip Aston

Constructor Summary
WeakValueHashMap()
           
 
Method Summary
 void clear()
          Clear all entries out of the map.
 V get(K key)
          Look up a value by key.
 void put(K key, V value)
          Add a value.
 V remove(K key)
          Remove an entry from the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakValueHashMap

public WeakValueHashMap()
Method Detail

clear

public void clear()
Clear all entries out of the map.


get

public V get(K key)
Look up a value by key.

Parameters:
key - The key.
Returns:
The value, or null if none found.

put

public void put(K key,
                V value)
Add a value.

Parameters:
key - The key.
value - The value.

remove

public V remove(K key)
Remove an entry from the map.

Parameters:
key - The key.
Returns:
The removed value, or null if none found.


Copyright © 2000-2013. All Rights Reserved.