Package com.biglybt.core.util
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 int
The default initial capacity - MUST be a power of two.(package private) static final float
(package private) final float
(package private) static final int
The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments.protected int
protected ByteArrayHashMap.Entry<T>[]
private int
-
Constructor Summary
ConstructorsConstructorDescriptionByteArrayHashMap
(int initialCapacity) ByteArrayHashMap
(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescription(package private) void
void
clear()
boolean
containsKey
(byte[] key) (package private) void
createEntry
(int hash, byte[] key, T value, int bucketIndex) Bit inefficient at the momentprivate static boolean
eq
(byte[] x, byte[] y) get
(byte[] key) get
(byte[] key, int offset, int len) private static int
hash
(byte[] x) private static int
indexFor
(int h, int length) boolean
isEmpty()
List<byte[]>
keys()
remove
(byte[] key) (package private) ByteArrayHashMap.Entry<T>
removeEntryForKey
(byte[] key) (package private) void
resize
(int newCapacity) int
size()
(package private) void
transfer
(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 <= 1<<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
Bit inefficient at the moment- Returns:
-
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)
-