public final class IntKeyMap<V> extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, java.lang.Iterable<IntKeyMap.Entry<V>>
FastCopyHashMap by Jason T. Greene.| Modifier and Type | Class and Description |
|---|---|
static class |
IntKeyMap.Entry<V>
A map entry.
|
| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_CAPACITY
Same default as HashMap, must be a power of 2
|
private static float |
DEFAULT_LOAD_FACTOR
67%, just like IdentityHashMap
|
private float |
loadFactor
The user defined load factor which defines when to resize
|
private static int |
MAXIMUM_CAPACITY
MAX_INT - 1
|
private static long |
serialVersionUID |
private int |
size
The current number of key-value pairs
|
private IntKeyMap.Entry<V>[] |
table
The open-addressed table
|
private int |
threshold
The next resize
|
| Constructor and Description |
|---|
IntKeyMap() |
IntKeyMap(int initialCapacity) |
IntKeyMap(int initialCapacity,
float loadFactor) |
IntKeyMap(IntKeyMap<? extends V> map) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
IntKeyMap<V> |
clone() |
boolean |
containsKey(int key) |
boolean |
containsValue(java.lang.Object value) |
private static boolean |
eq(java.lang.Object o1,
java.lang.Object o2) |
V |
get(int key) |
private static int |
index(int hashCode,
int length) |
private void |
init(int initialCapacity,
float loadFactor) |
boolean |
isEmpty() |
java.util.Iterator<IntKeyMap.Entry<V>> |
iterator()
Iterate over the entries.
|
private int |
nextIndex(int index,
int length) |
void |
printDebugStats() |
V |
put(int key,
V value) |
private void |
putForCreate(int key,
V value) |
private void |
readObject(java.io.ObjectInputStream s) |
private void |
relocate(int start) |
V |
remove(int key) |
private void |
resize(int from) |
int |
size() |
private void |
writeObject(java.io.ObjectOutputStream s) |
private static final int DEFAULT_CAPACITY
private static final int MAXIMUM_CAPACITY
private static final float DEFAULT_LOAD_FACTOR
private transient IntKeyMap.Entry<V>[] table
private transient int size
private transient int threshold
private final float loadFactor
private static final long serialVersionUID
public IntKeyMap(int initialCapacity,
float loadFactor)
public IntKeyMap(int initialCapacity)
public IntKeyMap()
private void init(int initialCapacity,
float loadFactor)
private int nextIndex(int index,
int length)
private static boolean eq(java.lang.Object o1,
java.lang.Object o2)
private static int index(int hashCode,
int length)
public int size()
public boolean isEmpty()
public V get(int key)
public boolean containsKey(int key)
public boolean containsValue(java.lang.Object value)
private void resize(int from)
public V remove(int key)
private void relocate(int start)
public void clear()
public void printDebugStats()
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprivate void putForCreate(int key,
V value)
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException
java.io.IOExceptionpublic java.util.Iterator<IntKeyMap.Entry<V>> iterator()
iterator in interface java.lang.Iterable<IntKeyMap.Entry<V>>