|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vladium.util.IntObjectMap
public final class IntObjectMap
MT-safety: an instance of this class is not safe for access from multiple concurrent threads [even if access is done by a single thread at a time]. The caller is expected to synchronize externally on an instance [the implementation does not do internal synchronization for the sake of efficiency]. java.util.ConcurrentModificationException is not supported either.
Nested Class Summary | |
---|---|
private static class |
IntObjectMap.Entry
The structure used for chaining colliding keys. |
Field Summary | |
---|---|
private static java.lang.String |
EOL
|
private IntObjectMap.Entry[] |
m_buckets
|
private float |
m_loadFactor
|
private int |
m_size
|
private int |
m_sizeThreshold
|
Constructor Summary | |
---|---|
IntObjectMap()
Equivalent to IntObjectMap(11, 0.75F) . |
|
IntObjectMap(int initialCapacity)
Equivalent to IntObjectMap(capacity, 0.75F) . |
|
IntObjectMap(int initialCapacity,
float loadFactor)
Constructs an IntObjectMap with specified initial capacity and load factor. |
Method Summary | |
---|---|
boolean |
contains(int key)
|
(package private) void |
debugDump(java.lang.StringBuffer out)
|
java.lang.Object |
get(int key)
Returns the value that is mapped to a given 'key'. |
int[] |
keys()
|
java.lang.Object |
put(int key,
java.lang.Object value)
Updates the table to map 'key' to 'value'. |
private void |
rehash()
Re-hashes the table into a new array of buckets. |
int |
size()
Returns the number of key-value mappings in this map. |
java.lang.String |
toString()
Overrides Object.toString() for debug purposes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final float m_loadFactor
private IntObjectMap.Entry[] m_buckets
private int m_size
private int m_sizeThreshold
private static final java.lang.String EOL
Constructor Detail |
---|
public IntObjectMap()
IntObjectMap(11, 0.75F)
.
public IntObjectMap(int initialCapacity)
IntObjectMap(capacity, 0.75F)
.
public IntObjectMap(int initialCapacity, float loadFactor)
initialCapacity
- initial number of hash buckets in the table [may not be negative, 0 is equivalent to 1].loadFactor
- the load factor to use to determine rehashing points [must be in (0.0, 1.0] range].Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public int size()
public boolean contains(int key)
public java.lang.Object get(int key)
key
- mapping key
public int[] keys()
public java.lang.Object put(int key, java.lang.Object value)
key
- mapping keyvalue
- mapping value [can be null].
void debugDump(java.lang.StringBuffer out)
private void rehash()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |