Package org.apache.tomcat.util.collections

## Class ManagedConcurrentWeakHashMap<K,​V>

- java.lang.Object
- - java.util.AbstractMap<K,​V>
  - - org.apache.tomcat.util.collections.ManagedConcurrentWeakHashMap<K,​V>

Type Parameters:
  `K` - The type of keys used with the Map instance
  `V` - The type of values used with the Map instance

All Implemented Interfaces:
  `java.util.concurrent.ConcurrentMap<K,​V>`, `java.util.Map<K,​V>`

    public class ManagedConcurrentWeakHashMap<K,​V>
    extends java.util.AbstractMap<K,​V>
    implements java.util.concurrent.ConcurrentMap<K,​V>

Concurrent hash map that holds its keys via weak references. Unlike `WeakHashMap` this class does not handle dead keys during common access operations, but expects you to call its `maintain()` method periodically. Both keys and values are expected to be not-`null`.

### 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>`

### Nested classes/interfaces inherited from interface java.util.Map

`java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>`

### Constructor Summary

Constructors
`ManagedConcurrentWeakHashMap()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clear()`
`boolean` `containsKey​(java.lang.Object key)`
`boolean` `containsValue​(java.lang.Object value)`
`java.util.Set<java.util.Map.Entry<K,​V>>` `entrySet()`
`V` `get​(java.lang.Object key)`
`boolean` `isEmpty()`
`void` `maintain()` Method, that has to be invoked periodically to clean dead keys from the map.
`V` `put​(K key, V value)`
`V` `putIfAbsent​(K key, V value)`
`V` `remove​(java.lang.Object key)`
`boolean` `remove​(java.lang.Object key, java.lang.Object value)`
`V` `replace​(K key, V value)`
`boolean` `replace​(K key, V oldValue, V newValue)`
`int` `size()`
`java.util.Collection<V>` `values()`

### Methods inherited from class java.util.AbstractMap

`clone, equals, hashCode, keySet, putAll, toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.concurrent.ConcurrentMap

`compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll`

### Methods inherited from interface java.util.Map

`equals, hashCode, keySet, putAll`

### Constructor Detail

#### ManagedConcurrentWeakHashMap

    public ManagedConcurrentWeakHashMap()

### Method Detail

#### maintain

    public void maintain()

Method, that has to be invoked periodically to clean dead keys from the map.

#### size

    public int size()

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

#### isEmpty

    public boolean isEmpty()

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

#### containsValue

    public boolean containsValue​(java.lang.Object value)

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

#### containsKey

    public boolean containsKey​(java.lang.Object key)

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

#### get

    public V get​(java.lang.Object key)

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

#### put

    public V put​(K key,
                 V value)

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

#### remove

    public V remove​(java.lang.Object key)

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

#### clear

    public void clear()

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

#### putIfAbsent

    public V putIfAbsent​(K key,
                         V value)

Specified by:
  `putIfAbsent` in interface `java.util.concurrent.ConcurrentMap<K,​V>`
Specified by:
  `putIfAbsent` in interface `java.util.Map<K,​V>`

#### remove

    public boolean remove​(java.lang.Object key,
                          java.lang.Object value)

Specified by:
  `remove` in interface `java.util.concurrent.ConcurrentMap<K,​V>`
Specified by:
  `remove` in interface `java.util.Map<K,​V>`

#### replace

    public boolean replace​(K key,
                           V oldValue,
                           V newValue)

Specified by:
  `replace` in interface `java.util.concurrent.ConcurrentMap<K,​V>`
Specified by:
  `replace` in interface `java.util.Map<K,​V>`

#### replace

    public V replace​(K key,
                     V value)

Specified by:
  `replace` in interface `java.util.concurrent.ConcurrentMap<K,​V>`
Specified by:
  `replace` in interface `java.util.Map<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.AbstractMap<K,​V>`

#### entrySet

    public java.util.Set<java.util.Map.Entry<K,​V>> entrySet()

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