Class IntKeyMap<V>
java.lang.Object
org.jboss.marshalling.util.IntKeyMap<V>
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<IntKeyMap.Entry<V>>
public final class IntKeyMap<V>
extends Object
implements Cloneable, Serializable, Iterable<IntKeyMap.Entry<V>>
An integer-keyed map, optimized for fast copying. Based on
FastCopyHashMap by Jason T. Greene.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intSame default as HashMap, must be a power of 2private static final float67%, just like IdentityHashMapprivate final floatThe user defined load factor which defines when to resizeprivate static final intMAX_INT - 1private static final longprivate intThe current number of key-value pairsprivate IntKeyMap.Entry<V>[]The open-addressed tableprivate intThe next resize -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()clone()booleancontainsKey(int key) booleancontainsValue(Object value) private static booleanget(int key) private static intindex(int hashCode, int length) private voidinit(int initialCapacity, float loadFactor) booleanisEmpty()iterator()Iterate over the entries.private intnextIndex(int index, int length) voidprivate voidputForCreate(int key, V value) private voidprivate voidrelocate(int start) remove(int key) private voidresize(int from) intsize()private voidMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_CAPACITY
private static final int DEFAULT_CAPACITYSame default as HashMap, must be a power of 2- See Also:
-
MAXIMUM_CAPACITY
private static final int MAXIMUM_CAPACITYMAX_INT - 1- See Also:
-
DEFAULT_LOAD_FACTOR
private static final float DEFAULT_LOAD_FACTOR67%, just like IdentityHashMap- See Also:
-
table
The open-addressed table -
size
private transient int sizeThe current number of key-value pairs -
threshold
private transient int thresholdThe next resize -
loadFactor
private final float loadFactorThe user defined load factor which defines when to resize -
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
IntKeyMap
public IntKeyMap(int initialCapacity, float loadFactor) -
IntKeyMap
-
IntKeyMap
public IntKeyMap(int initialCapacity) -
IntKeyMap
public IntKeyMap()
-
-
Method Details
-
init
private void init(int initialCapacity, float loadFactor) -
nextIndex
private int nextIndex(int index, int length) -
eq
-
index
private static int index(int hashCode, int length) -
size
public int size() -
isEmpty
public boolean isEmpty() -
get
-
containsKey
public boolean containsKey(int key) -
containsValue
-
put
-
resize
private void resize(int from) -
remove
-
relocate
private void relocate(int start) -
clear
public void clear() -
clone
-
printDebugStats
public void printDebugStats() -
readObject
- Throws:
IOExceptionClassNotFoundException
-
putForCreate
-
writeObject
- Throws:
IOException
-
iterator
-