Class WeakValueHashMap<K,​V>

    • Constructor Detail

      • WeakValueHashMap

        public WeakValueHashMap​(int initialCapacity,
                                float loadFactor)
        Constructs a new, empty WeakValueHashMap with the given initial capacity and the given load factor.
        Parameters:
        initialCapacity - The initial capacity of the WeakValueHashMap
        loadFactor - The load factor of the WeakValueHashMap
        Throws:
        IllegalArgumentException - If the initial capacity is less than zero, or if the load factor is nonpositive
      • WeakValueHashMap

        public WeakValueHashMap​(int initialCapacity)
        Constructs a new, empty WeakValueHashMap with the given initial capacity and the default load factor, which is 0.75.
        Parameters:
        initialCapacity - The initial capacity of the WeakValueHashMap
        Throws:
        IllegalArgumentException - If the initial capacity is less than zero
      • WeakValueHashMap

        public WeakValueHashMap()
        Constructs a new, empty WeakValueHashMap with the default initial capacity and the default load factor, which is 0.75.
      • WeakValueHashMap

        public WeakValueHashMap​(Map<K,​V> t)
        Constructs a new WeakValueHashMap with the same mappings as the specified Map. The WeakValueHashMap is created with an initial capacity of twice the number of mappings in the specified map or 11 (whichever is greater), and a default load factor, which is 0.75.
        Parameters:
        t - the map whose mappings are to be placed in this map.
        Since:
        1.3
    • Method Detail

      • size

        public int size()
      • containsKey

        public boolean containsKey​(Object key)
      • get

        public V get​(Object key)
      • put

        public V put​(K key,
                     V value)
      • remove

        public V remove​(Object key)
      • clear

        public void clear()
      • toString

        public String toString()