Class ByteArrayHashMap<T>
java.lang.Object
com.biglybt.core.util.ByteArrayHashMap<T>
- Direct Known Subclasses:
RelatedContentManager.ByteArrayHashMapEx
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intThe default initial capacity - MUST be a power of two.(package private) static final float(package private) final float(package private) static final intThe maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments.protected intprotected ByteArrayHashMap.Entry<T>[]private int -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayHashMap(int initialCapacity) ByteArrayHashMap(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescription(package private) voidvoidclear()booleancontainsKey(byte[] key) (package private) voidcreateEntry(int hash, byte[] key, T value, int bucketIndex) Bit inefficient at the momentprivate static booleaneq(byte[] x, byte[] y) get(byte[] key) get(byte[] key, int offset, int len) private static inthash(byte[] x) private static intindexFor(int h, int length) booleanisEmpty()List<byte[]> keys()remove(byte[] key) (package private) ByteArrayHashMap.Entry<T> removeEntryForKey(byte[] key) (package private) voidresize(int newCapacity) ///////////////////////////////intsize()(package private) voidtransfer(ByteArrayHashMap.Entry<T>[] newTable) values()
-
Field Details
-
DEFAULT_INITIAL_CAPACITY
static final int DEFAULT_INITIAL_CAPACITYThe default initial capacity - MUST be a power of two.- See Also:
-
MAXIMUM_CAPACITY
static final int MAXIMUM_CAPACITYThe maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments. MUST be a power of two invalid input: '<'= 1invalid input: '<'invalid input: '<'30.- See Also:
-
DEFAULT_LOAD_FACTOR
static final float DEFAULT_LOAD_FACTOR- See Also:
-
table
-
size
protected int size -
threshold
private int threshold -
loadFactor
final float loadFactor
-
-
Constructor Details
-
ByteArrayHashMap
public ByteArrayHashMap(int initialCapacity, float loadFactor) -
ByteArrayHashMap
public ByteArrayHashMap(int initialCapacity) -
ByteArrayHashMap
public ByteArrayHashMap()
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
get
-
get
-
containsKey
public boolean containsKey(byte[] key) -
put
-
remove
-
clear
public void clear() -
keys
-
values
-
duplicate
-
resize
void resize(int newCapacity) /////////////////////////////// -
transfer
-
removeEntryForKey
-
addEntry
-
createEntry
-
hash
private static int hash(byte[] x) -
eq
private static boolean eq(byte[] x, byte[] y) -
indexFor
private static int indexFor(int h, int length)
-