|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.util.OpenIntToDoubleHashMap
public class OpenIntToDoubleHashMap
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.
Nested Class Summary | |
---|---|
class |
OpenIntToDoubleHashMap.Iterator
Iterator class for the map. |
Field Summary | |
---|---|
protected static byte |
FREE
Status indicator for free table entries. |
protected static byte |
FULL
Status indicator for full table entries. |
protected static byte |
REMOVED
Status indicator for removed table entries. |
Constructor Summary | |
---|---|
OpenIntToDoubleHashMap()
Build an empty map with default size and using NaN for missing entries. |
|
OpenIntToDoubleHashMap(double missingEntries)
Build an empty map with default size |
|
OpenIntToDoubleHashMap(int expectedSize)
Build an empty map with specified size and using NaN for missing entries. |
|
OpenIntToDoubleHashMap(int expectedSize,
double missingEntries)
Build an empty map with specified size. |
|
OpenIntToDoubleHashMap(OpenIntToDoubleHashMap source)
Copy constructor. |
Method Summary | |
---|---|
boolean |
containsKey(int key)
Check if a value is associated with a key. |
double |
get(int key)
Get the stored value associated with the given key |
OpenIntToDoubleHashMap.Iterator |
iterator()
Get an iterator over map elements. |
double |
put(int key,
double value)
Put a value associated with a key in the map. |
double |
remove(int key)
Remove the value associated with a key. |
int |
size()
Get the number of elements stored in the map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final byte FREE
protected static final byte FULL
protected static final byte REMOVED
Constructor Detail |
---|
public OpenIntToDoubleHashMap()
public OpenIntToDoubleHashMap(double missingEntries)
missingEntries
- value to return when a missing entry is fetchedpublic OpenIntToDoubleHashMap(int expectedSize)
expectedSize
- expected number of elements in the mappublic OpenIntToDoubleHashMap(int expectedSize, double missingEntries)
expectedSize
- expected number of elements in the mapmissingEntries
- value to return when a missing entry is fetchedpublic OpenIntToDoubleHashMap(OpenIntToDoubleHashMap source)
source
- map to copyMethod Detail |
---|
public double get(int key)
key
- key associated with the data
public boolean containsKey(int key)
key
- key to check
public OpenIntToDoubleHashMap.Iterator iterator()
The specialized iterators returned are fail-fast: they throw a
ConcurrentModificationException
when they detect the map
has been modified during iteration.
public int size()
public double remove(int key)
key
- key to which the value is associated
public double put(int key, double value)
key
- key to which value is associatedvalue
- value to put in the map
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |