Interface IntToIntMap

All Known Implementing Classes:
IntRangeToIntMap, IntToIntArrayMap, IntToIntHashMap

public interface IntToIntMap
Interface defining a map from integers to integers
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the map.
    boolean
    contains(int key)
    Finds whether a key is present in the map.
    int
    get(int key)
    Gets the value for this key.
    int
    Get the default value used to indicate an unused entry
    Get an iterator over the integer key values held in the hash map
    void
    put(int key, int value)
    Adds a key-value pair to the map.
    boolean
    remove(int key)
    Removes a key from the map.
    void
    setDefaultValue(int defaultValue)
    Set the value to be returned to indicate an unused entry
    int
    Gets the size of the map.
  • Method Details

    • setDefaultValue

      void setDefaultValue(int defaultValue)
      Set the value to be returned to indicate an unused entry
      Parameters:
      defaultValue - the value to be returned by get(int) if no entry exists for the supplied key
    • getDefaultValue

      int getDefaultValue()
      Get the default value used to indicate an unused entry
      Returns:
      the value to be returned by get(int) if no entry exists for the supplied key
    • clear

      void clear()
      Clear the map.
    • contains

      boolean contains(int key)
      Finds whether a key is present in the map.
      Parameters:
      key - Key
      Returns:
      true if the key is mapped
    • get

      int get(int key)
      Gets the value for this key.
      Parameters:
      key - Key
      Returns:
      the value, or the default value if not found.
    • size

      int size()
      Gets the size of the map.
      Returns:
      the size
    • remove

      boolean remove(int key)
      Removes a key from the map.
      Parameters:
      key - Key to remove
      Returns:
      true if the value was removed
    • put

      void put(int key, int value)
      Adds a key-value pair to the map.
      Parameters:
      key - Key
      value - Value
    • keyIterator

      IntIterator keyIterator()
      Get an iterator over the integer key values held in the hash map
      Returns:
      an iterator whose next() call returns the key values (in arbitrary order)