Class LazyResettableHashMap<T>

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

    public class LazyResettableHashMap<T>
    extends java.lang.Object
    Lazily initialized hash map for caching images.
    • Field Detail

      • displayName

        private java.lang.String displayName
        Display name of this hash map. Is used for tracking the statistics.
    • Constructor Detail

      • LazyResettableHashMap

        public LazyResettableHashMap​(java.lang.String displayName)
        Creates a new hash map.
        Parameters:
        displayName - Display name of the new hash map.
    • 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 null if none.
      • containsKey

        public boolean containsKey​(LazyResettableHashMap.Key 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 java.util.List<java.lang.String> getStats()
        Returns statistical information of the existing hash maps.
        Returns:
        Statistical information of the existing hash maps.