Package smile.util
Class IntDoubleHashMap
java.lang.Object
smile.util.IntDoubleHashMap
HashMap<int, double>
for primitive types.
Integer.MIN_VALUE (0x80000000)
is not allowed as key.-
Constructor Summary
ConstructorDescriptionConstructs 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 TypeMethodDescriptiondouble
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
size()
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 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.
-