Class IntRWHashMap<V>

  • All Implemented Interfaces:
    IntMap<V>

    public class IntRWHashMap<V>
    extends Object
    implements IntMap<V>
    Read-write lock wrapper for IntMap.
    • Constructor Detail

      • IntRWHashMap

        public IntRWHashMap()
        Default constructor.
    • Method Detail

      • get

        public V get​(int key)
        Returns value associated with the key. if the map doesn't contain the key, returns null.
        Specified by:
        get in interface IntMap<V>
        Parameters:
        key - key with which the specified value is to be associated.
      • put

        public V put​(int key,
                     V val)
        Save the pair into the map. If a pair is present, returns old value and store new.
        Specified by:
        put in interface IntMap<V>
        Parameters:
        key - key with which the specified value is to be associated.
        val - value to be associated with the specified key.
      • remove

        public V remove​(int key)
        Specified by:
        remove in interface IntMap<V>
        Parameters:
        key - key with which the specified value is to be associated.
      • putIfAbsent

        public V putIfAbsent​(int key,
                             V val)
        Does put into the map if a pair isn't present, otherwise returns stored value.
        Specified by:
        putIfAbsent in interface IntMap<V>
        Parameters:
        key - key with which the specified value is to be associated..
        val - value to be associated with the specified key..
      • size

        public int size()
        Returns count of elements.
        Specified by:
        size in interface IntMap<V>
      • isEmpty

        public boolean isEmpty()
        Returns true if this map contains no key-value mappings.
        Specified by:
        isEmpty in interface IntMap<V>
      • keys

        public int[] keys()
        Returns array of keys.
        Specified by:
        keys in interface IntMap<V>
      • containsKey

        public boolean containsKey​(int key)
        Returns true if the map contains the key, otherwise false.
        Specified by:
        containsKey in interface IntMap<V>
        Parameters:
        key - tests key value.
      • containsValue

        public boolean containsValue​(V val)
        Returns true if the map contains one or more values, otherwise false.
        Specified by:
        containsValue in interface IntMap<V>
        Parameters:
        val - value to be associated with the specified key.
      • clear

        public void clear()
        Removes all of the mappings from this map.
        Specified by:
        clear in interface IntMap<V>