Class WeakWeakMap<K,​V>

  • All Implemented Interfaces:
    java.util.Map<K,​V>

    public class WeakWeakMap<K,​V>
    extends java.util.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 $
    See Also:
    WeakHashMap, WeakReference
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      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​(java.util.Map<? extends K,​? extends V> pMap)
      Creates a WeakWeakMap containing the mappings in the given map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsValue​(java.lang.Object pValue)  
      java.util.Set<java.util.Map.Entry<K,​V>> entrySet()  
      V get​(java.lang.Object pKey)  
      V put​(K pKey, V pValue)  
      void putAll​(java.util.Map<? extends K,​? extends V> pMap)  
      V remove​(java.lang.Object pKey)  
      java.util.Collection<V> values()  
      • Methods inherited from class java.util.WeakHashMap

        clear, containsKey, forEach, isEmpty, keySet, replaceAll, 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

        compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace
    • Constructor Detail

      • WeakWeakMap

        public WeakWeakMap()
        Creates a WeakWeakMap with default initial capacity and load factor.
        See Also:
        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(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(int, float)
      • WeakWeakMap

        public WeakWeakMap​(java.util.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(java.util.Map)
    • Method Detail

      • put

        public V put​(K pKey,
                     V pValue)
        Specified by:
        put in interface java.util.Map<K,​V>
        Overrides:
        put in class java.util.WeakHashMap<K,​V>
      • get

        public V get​(java.lang.Object pKey)
        Specified by:
        get in interface java.util.Map<K,​V>
        Overrides:
        get in class java.util.WeakHashMap<K,​V>
      • remove

        public V remove​(java.lang.Object pKey)
        Specified by:
        remove in interface java.util.Map<K,​V>
        Overrides:
        remove in class java.util.WeakHashMap<K,​V>
      • containsValue

        public boolean containsValue​(java.lang.Object pValue)
        Specified by:
        containsValue in interface java.util.Map<K,​V>
        Overrides:
        containsValue in class java.util.WeakHashMap<K,​V>
      • putAll

        public void putAll​(java.util.Map<? extends K,​? extends V> pMap)
        Specified by:
        putAll in interface java.util.Map<K,​V>
        Overrides:
        putAll in class java.util.WeakHashMap<K,​V>
      • entrySet

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

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