Class ObjectLongHashMap

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map

    public class ObjectLongHashMap
    extends java.util.HashMap
    This class is a map which binds key Object to long value.

    This class is NOT thread safe, synchronize read and write operation when used in multi-threaded context if you really need features provided by this collection.
    In multithreaded context, it may be wiser to use alternative thread safe and type safe collection such as ConcurrentHashMap<YourType, Long>.

    Since:
    jcms-5.5.0
    Version:
    $Revision: 107391 $
    See Also:
    Serialized Form
    • 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>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String REVISION  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      long getLong​(java.lang.Object key, long defaultValue)
      Return the long value associated with given object, or the given default value if object is not in this map.
      long getMax()
      Return maximum value stored in this map.
      void put​(java.lang.Object key, long value)
      Associates the specified value with the specified key in this map.
      java.lang.Object remove​(java.lang.Object key)  
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • ObjectLongHashMap

        public ObjectLongHashMap()
    • Method Detail

      • remove

        public java.lang.Object remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map
        Overrides:
        remove in class java.util.HashMap
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map
        Overrides:
        clear in class java.util.HashMap
      • put

        public void put​(java.lang.Object key,
                        long value)
        Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.
        Parameters:
        key - key with which the specified value is to be associated.
        value - value to be associated with the specified key.
      • getLong

        public long getLong​(java.lang.Object key,
                            long defaultValue)
        Return the long value associated with given object, or the given default value if object is not in this map.
        Parameters:
        key - the object from which to get associated value
        defaultValue - the default value to use if object not present.
        Returns:
        long value associated to object
      • getMax

        public long getMax()
        Return maximum value stored in this map.
        Returns:
        maximum long value