Class OpenIntToDoubleHashMap

java.lang.Object
org.hipparchus.util.AbstractOpenIntHashMap
org.hipparchus.util.OpenIntToDoubleHashMap
All Implemented Interfaces:
Serializable

public class OpenIntToDoubleHashMap extends AbstractOpenIntHashMap implements Serializable
Open addressed map from int to double.

This class provides a dedicated map from integers to doubles with a much smaller memory overhead than standard java.util.Map.

This class is not synchronized. The specialized iterators returned by iterator() are fail-fast: they throw a ConcurrentModificationException when they detect the map has been modified during iteration.

See Also:
  • Constructor Details

    • OpenIntToDoubleHashMap

      public OpenIntToDoubleHashMap()
      Build an empty map with default size and using NaN for missing entries.
    • OpenIntToDoubleHashMap

      public OpenIntToDoubleHashMap(double missingEntries)
      Build an empty map with default size
      Parameters:
      missingEntries - value to return when a missing entry is fetched
    • OpenIntToDoubleHashMap

      public OpenIntToDoubleHashMap(int expectedSize)
      Build an empty map with specified size and using NaN for missing entries.
      Parameters:
      expectedSize - expected number of elements in the map
    • OpenIntToDoubleHashMap

      public OpenIntToDoubleHashMap(int expectedSize, double missingEntries)
      Build an empty map with specified size.
      Parameters:
      expectedSize - expected number of elements in the map
      missingEntries - value to return when a missing entry is fetched
    • OpenIntToDoubleHashMap

      public OpenIntToDoubleHashMap(OpenIntToDoubleHashMap source)
      Copy constructor.
      Parameters:
      source - map to copy
  • Method Details

    • get

      public double get(int key)
      Get the stored value associated with the given key
      Parameters:
      key - key associated with the data
      Returns:
      data associated with the key
    • iterator

      Get an iterator over map elements.

      The specialized iterators returned are fail-fast: they throw a ConcurrentModificationException when they detect the map has been modified during iteration.

      Returns:
      iterator over the map elements
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • remove

      public double remove(int key)
      Remove the value associated with a key.
      Parameters:
      key - key to which the value is associated
      Returns:
      removed value
    • put

      public double put(int key, double value)
      Put a value associated with a key in the map.
      Parameters:
      key - key to which value is associated
      value - value to put in the map
      Returns:
      previous value associated with the key
    • growTable

      protected int growTable(int oldIndex)
      Grow the tables.
      Specified by:
      growTable in class AbstractOpenIntHashMap
      Parameters:
      oldIndex - index the entry being inserted should have used
      Returns:
      index the entry being inserted should really use