Class IntDoubleHashMap
java.lang.Object
smile.util.IntDoubleHashMap
- All Implemented Interfaces:
Serializable
HashMap<int, double> for primitive types.
Integer.MIN_VALUE (0x80000000) is not allowed as key.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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 TypeMethodDescriptiondoubleget(int key) Returns the value to which the specified key is mapped, or Double.NaN if this map contains no mapping for the key.booleanisEmpty()Returns true if this map contains no key-value mappings.doubleput(int key, double value) Associates the specified value with the specified key in this map.doubleremove(int key) Removes the mapping for the specified key from this map if present.intsize()Returns the number of key-value mappings in this map.
-
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 previous value, or
Double.NaNif not present.
-
isEmpty
public boolean isEmpty()Returns true if this map contains no key-value mappings.- Returns:
- true if this map is empty.
-
size
public int size()Returns the number of key-value mappings in this map.- Returns:
- the number of key-value mappings in this map.
-