Class IntIntHashMap

    • Constructor Detail

      • IntIntHashMap

        public IntIntHashMap()
      • IntIntHashMap

        public IntIntHashMap​(int initialCapacity)
      • IntIntHashMap

        public IntIntHashMap​(int initialCapacity,
                             float loadFactor)
    • Method Detail

      • clone

        public Object clone()
        Disclaimer: If the value type doesn't implement clone(), only the reference is copied. Note: Due to private fields we cannot implement a copy constructor, sorry.
        clone in class Object
        source - the primitive hash map to copy
      • containsValue

        public boolean containsValue​(int value)
      • containsKey

        public boolean containsKey​(int key)
      • get

        public int get​(int key)
        Returns the value to which the specified key is mapped, or getKeyNotFoundValue() if this map contains no mapping for the key.
      • put

        public int put​(int key,
                       int value)
        Maps the key to the specified value. If a mapping to this key already exists, the previous value will be returned (otherwise getKeyNotFoundValue()).
      • putAll

        public void putAll​(IntIntHashMap source)
        Copies all of the mappings from the specified map to this map.
      • remove

        public int remove​(int key)
        Removes the key-value mapping from this map. Returns the previously mapped value or getKeyNotFoundValue() if no such mapping exists.
      • size

        public int size()
        Returns the current number of key-value mappings in this map.
      • capacity

        public int capacity()
        Returns the current capacity (buckets) in this map.
      • clear

        public void clear()
        Clears the entire map. The size is 0 after this operation.
      • setKeyNotFoundValue

        public int setKeyNotFoundValue​(int newKeyNotFoundValue)
        Sets the new key not found value. For primitive types (int, long) the default is -1, for Object types, the default is null.
        the previous key not found value
        See Also:
        get(int), put(int, int)
      • getKeyNotFoundValue

        public int getKeyNotFoundValue()
        Returns the value which is returned if no value has been found for the specified key.
        See Also:
        get(int), put(int, int)
      • toString

        public StringBuilder toString​(StringBuilder sb)
        sb - if null, a new StringBuilder is created
        StringBuilder instance with appended string information of this Entry