com.twelvemonkeys.util
Class WeakWeakMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.WeakHashMap<K,V>
          extended by com.twelvemonkeys.util.WeakWeakMap<K,V>
All Implemented Interfaces:
Map<K,V>

public class WeakWeakMap<K,V>
extends WeakHashMap<K,V>

Special-purpose map implementation with weak keys and weak values. This is useful for mapping between keys and values that refer to (for example by wrapping) their keys. For more info, see WeakHashMap on why the values in a WeakHashMap must never refer strongly to their keys.

Version:
$Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/util/WeakWeakMap.java#1 $
Author:
Harald Kuhr
See Also:
WeakHashMap, WeakReference

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
WeakWeakMap()
          Creates a WeakWeakMap with default initial capacity and load factor.
WeakWeakMap(int pInitialCapacity)
          Creates a WeakWeakMap with the given initial capacity and default load factor.
WeakWeakMap(int pInitialCapacity, float pLoadFactor)
          Creates a WeakWeakMap with the given initial capacity and load factor.
WeakWeakMap(Map<? extends K,? extends V> pMap)
          Creates a WeakWeakMap containing the mappings in the given map.
 
Method Summary
 boolean containsValue(Object pValue)
           
 Set<Map.Entry<K,V>> entrySet()
           
 V get(Object pKey)
           
 V put(K pKey, V pValue)
           
 void putAll(Map<? extends K,? extends V> pMap)
           
 V remove(Object pKey)
           
 Collection<V> values()
           
 
Methods inherited from class java.util.WeakHashMap
clear, containsKey, isEmpty, keySet, size
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

WeakWeakMap

public WeakWeakMap()
Creates a WeakWeakMap with default initial capacity and load factor.

See Also:
WeakHashMap.WeakHashMap()

WeakWeakMap

public WeakWeakMap(int pInitialCapacity)
Creates a WeakWeakMap with the given initial capacity and default load factor.

Parameters:
pInitialCapacity - the initial capacity
See Also:
WeakHashMap.WeakHashMap(int)

WeakWeakMap

public WeakWeakMap(int pInitialCapacity,
                   float pLoadFactor)
Creates a WeakWeakMap with the given initial capacity and load factor.

Parameters:
pInitialCapacity - the initial capacity
pLoadFactor - the load factor
See Also:
WeakHashMap.WeakHashMap(int, float)

WeakWeakMap

public WeakWeakMap(Map<? extends K,? extends V> pMap)
Creates a WeakWeakMap containing the mappings in the given map.

Parameters:
pMap - the map whose mappings are to be placed in this map.
See Also:
WeakHashMap.WeakHashMap(java.util.Map)
Method Detail

put

public V put(K pKey,
             V pValue)
Specified by:
put in interface Map<K,V>
Overrides:
put in class WeakHashMap<K,V>

get

public V get(Object pKey)
Specified by:
get in interface Map<K,V>
Overrides:
get in class WeakHashMap<K,V>

remove

public V remove(Object pKey)
Specified by:
remove in interface Map<K,V>
Overrides:
remove in class WeakHashMap<K,V>

containsValue

public boolean containsValue(Object pValue)
Specified by:
containsValue in interface Map<K,V>
Overrides:
containsValue in class WeakHashMap<K,V>

putAll

public void putAll(Map<? extends K,? extends V> pMap)
Specified by:
putAll in interface Map<K,V>
Overrides:
putAll in class WeakHashMap<K,V>

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>
Overrides:
entrySet in class WeakHashMap<K,V>

values

public Collection<V> values()
Specified by:
values in interface Map<K,V>
Overrides:
values in class WeakHashMap<K,V>


Copyright © 2014. All Rights Reserved.