# Class: com.pnfsoftware.jeb.util.concurrent.WeakConcurrentMap

A thread\-safe map with weak keys. Entries are based on a key's system hash code and keys are considered equal only by reference equality. 

 This class does not implement the [java.util.Map](java.util.Map) interface because this implementation is incompatible with the map contract. While iterating over a map's entries, any key that has not passed iteration is referenced non\-weakly.

## Constructor: WeakConcurrentMap
- parameter: `cleanerThread`, type: `boolean`

Description: Create a weak\-key concurrent map.
parameter: cleanerThread: `true` if a thread should be started that removes stale entries.

## Field: target
Type: `java.util.concurrent.ConcurrentMap<com.pnfsoftware.jeb.util.concurrent.WeakConcurrentMap.IWeakKey<K>,V>`
Description: Backing map used to store weak keys and their associated values.

## Method: approximateSize
- return type: `int`

Description: Returns the approximate size of this map where the returned number is at least as big as the actual number of entries.
return: the approximate size of this map

## Method: clear

Description: Clears the entire map.

## Method: containsKey
- parameter: `key`, type: `K`
- return type: `boolean`

Description: 
parameter: key: The key of the entry.
return: `true` if the key already defines a value.

## Protected Method: defaultValue
- parameter: `key`, type: `K`
- return type: `V`

Description: Creates a default value. There is no guarantee that the requested value will be set as a once it is created in case that another thread requests a value for a key concurrently.
parameter: key: The key for which to create a default value.
return: The default value for a key without value or `null` for not defining a default         value.

## Method: expungeStaleEntries

Description: Cleans all unused references.

## Method: get
- parameter: `key`, type: `K`
- return type: `V`

Description: 
parameter: key: The key of the entry.
return: The value of the entry or the default value if it did not exist.

## Method: getCleanerThread
- return type: `java.lang.Thread`

Description: 
return: The cleaner thread or `null` if no such thread was set.

## Method: iterator
- return type: `java.util.Iterator<java.util.Map.Entry<K,V>>`

Description: Iterate over live entries.
return: an iterator over entries whose keys have not been collected

## Method: put
- parameter: `key`, type: `K`
- parameter: `value`, type: `V`
- return type: `V`

Description: 
parameter: key: The key of the entry.
parameter: value: The value of the entry.
return: The previous entry or `null` if it does not exist.

## Method: remove
- parameter: `key`, type: `K`
- return type: `V`

Description: 
parameter: key: The key of the entry.
return: The removed entry or `null` if it does not exist.

## Method: run

Description: Run the cleaner loop until interrupted, then clear the map.

