Package smile.util

Class IntDoubleHashMap

java.lang.Object
smile.util.IntDoubleHashMap

public class IntDoubleHashMap extends Object
HashMap<int, double> for primitive types. Integer.MIN_VALUE (0x80000000) is not allowed as key.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75).
    IntDoubleHashMap(int initialCapacity, float loadFactor)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    get(int key)
    Returns the value to which the specified key is mapped, or Double.NaN if this map contains no mapping for the key.
    double
    put(int key, double value)
    Associates the specified value with the specified key in this map.
    double
    remove(int key)
    Removes the mapping for the specified key from this map if present.
    int
    Returns the number of key-value mappings in this map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IntDoubleHashMap

      public IntDoubleHashMap()
      Constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75).
    • IntDoubleHashMap

      public IntDoubleHashMap(int initialCapacity, float loadFactor)
      Constructor.
      Parameters:
      initialCapacity - the initial capacity.
      loadFactor - the load factor.
  • Method Details

    • get

      public double get(int key)
      Returns the value to which the specified key is mapped, or Double.NaN if this map contains no mapping for the key.
      Parameters:
      key - the key.
      Returns:
      the value.
    • put

      public double put(int key, double value)
      Associates the specified value with the specified key in this map.
      Parameters:
      key - the key.
      value - the value.
      Returns:
      the old value.
    • remove

      public double remove(int key)
      Removes the mapping for the specified key from this map if present.
      Parameters:
      key - the key.
      Returns:
      the value.
    • size

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