T
- the type of the objectspublic class OpenIntToIExprHashMap
extends java.lang.Object
implements java.io.Serializable
This class provides a dedicated map from integers to IExprs 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.
Modifier and Type | Class and Description |
---|---|
class |
OpenIntToIExprHashMap.Iterator
Iterator class for the map.
|
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
OpenIntToIExprHashMap()
Build an empty map with default size and using zero for missing entries.
|
OpenIntToIExprHashMap(int expectedSize)
Build an empty map with specified size.
|
OpenIntToIExprHashMap(OpenIntToIExprHashMap source)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(int key)
Check if a value is associated with a key.
|
IExpr |
get(int key)
Get the stored value associated with the given key
|
OpenIntToIExprHashMap.Iterator |
iterator()
Get an iterator over map elements.
|
IExpr |
put(int key,
IExpr value)
Put a value associated with a key in the map.
|
IExpr |
remove(int key)
Remove the value associated with a key.
|
int |
size()
Get the number of elements stored in the map.
|
protected static final byte FREE
protected static final byte FULL
protected static final byte REMOVED
public OpenIntToIExprHashMap()
field
- field to which the elements belongpublic OpenIntToIExprHashMap(int expectedSize)
field
- field to which the elements belongexpectedSize
- expected number of elements in the mapmissingEntries
- value to return when a missing entry is fetchedpublic OpenIntToIExprHashMap(OpenIntToIExprHashMap source)
source
- map to copypublic IExpr get(int key)
key
- key associated with the datapublic boolean containsKey(int key)
key
- key to checkpublic OpenIntToIExprHashMap.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 IExpr remove(int key)
key
- key to which the value is associated