Class LazyResettableHashMap<T>
- java.lang.Object
-
- org.pushingpixels.radiance.theming.internal.utils.LazyResettableHashMap<T>
-
- Type Parameters:
T- Class for the stored values.
public class LazyResettableHashMap<T> extends java.lang.ObjectLazily initialized hash map for caching images.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLazyResettableHashMap.Key
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<LazyResettableHashMap<?>>allList of all existing maps.private java.util.Map<LazyResettableHashMap.Key,T>cacheThe delegate cache.private java.lang.StringdisplayNameDisplay name of this hash map.
-
Constructor Summary
Constructors Constructor Description LazyResettableHashMap(java.lang.String displayName)Creates a new hash map.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(LazyResettableHashMap.Key key)Checks whether there is a value associated with the specified key.private voidcreateIfNecessary()Creates the delegate cache if necessary.Tget(LazyResettableHashMap.Key key)Returns the value registered for the specified key.static java.util.List<java.lang.String>getStats()Returns statistical information of the existing hash maps.voidput(LazyResettableHashMap.Key key, T entry)Puts a new key-value pair in the map.static voidreset()Resets all existing hash maps.intsize()Returns the number of key-value pairs of this hash map.
-
-
-
Field Detail
-
all
private static java.util.List<LazyResettableHashMap<?>> all
List of all existing maps.
-
cache
private java.util.Map<LazyResettableHashMap.Key,T> cache
The delegate cache.
-
displayName
private java.lang.String displayName
Display name of this hash map. Is used for tracking the statistics.
-
-
Method Detail
-
createIfNecessary
private void createIfNecessary()
Creates the delegate cache if necessary.
-
put
public void put(LazyResettableHashMap.Key key, T entry)
Puts a new key-value pair in the map.- Parameters:
key- Pair key.entry- Pair value.
-
get
public T get(LazyResettableHashMap.Key key)
Returns the value registered for the specified key.- Parameters:
key- Key.- Returns:
- Registered value or
nullif none.
-
containsKey
public boolean containsKey(LazyResettableHashMap.Key key)
Checks whether there is a value associated with the specified key.- Parameters:
key- Key.- Returns:
trueif there is an associated value,falseotherwise.
-
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 java.util.List<java.lang.String> getStats()
Returns statistical information of the existing hash maps.- Returns:
- Statistical information of the existing hash maps.
-
-