Package org.pushingpixels.substance.internal.utils

# Class LazyResettableHashMap<T>

java.lang.Object
org.pushingpixels.substance.internal.utils.LazyResettableHashMap<T>

Type Parameters:
  `T` - Class for the stored values.

public class LazyResettableHashMap<T> extends Object
Lazily initialized hash map for caching images. Note that this class is not thread safe. In Substance, it is used only from EDT.

## Constructor Summary

Constructors
Constructor
Description
`LazyResettableHashMap(String displayName)`
Creates a new hash map.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`containsKey(HashMapKey key)`
Checks whether there is a value associated with the specified key.
`T`
`get(HashMapKey key)`
Returns the value registered for the specified key.
`static List<String>`
`getStats()`
Returns statistical information of the existing hash maps.
`void`
`put(HashMapKey key, T entry)`
Puts a new key-value pair in the map.
`static void`
`reset()`
Resets all existing hash maps.
`int`
`size()`
Returns the number of key-value pairs of this hash map.

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LazyResettableHashMap

public LazyResettableHashMap(String displayName)
Creates a new hash map.

Parameters:
  `displayName` - Display name of the new hash map.

## Method Details

### put

public void put(HashMapKey key, T entry)
Puts a new key-value pair in the map.

Parameters:
  `key` - Pair key.
  `entry` - Pair value.

### get

public T get(HashMapKey key)
Returns the value registered for the specified key.

Parameters:
  `key` - Key.
Returns:
  Registered value or `null` if none.

### containsKey

public boolean containsKey(HashMapKey key)
Checks whether there is a value associated with the specified key.

Parameters:
  `key` - Key.
Returns:
  `true` if there is an associated value, `false` otherwise.

### size

public int size()
Returns the number of key-value pairs of this hash map.

Returns:
  The number of key-value pairs of this hash map.

### reset

public static void reset()
Resets all existing hash maps.

### getStats

public static List<String> getStats()
Returns statistical information of the existing hash maps.

Returns:
  Statistical information of the existing hash maps.