Package com.biglybt.core.util
Class ByteArrayHashMap<T>
- java.lang.Object
-
- com.biglybt.core.util.ByteArrayHashMap<T>
-
- Direct Known Subclasses:
RelatedContentManager.ByteArrayHashMapEx
public class ByteArrayHashMap<T> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ByteArrayHashMap.Entry<S>
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
DEFAULT_INITIAL_CAPACITY
The default initial capacity - MUST be a power of two.(package private) static float
DEFAULT_LOAD_FACTOR
(package private) float
loadFactor
(package private) static int
MAXIMUM_CAPACITY
The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments.protected int
size
protected ByteArrayHashMap.Entry<T>[]
table
private int
threshold
-
Constructor Summary
Constructors Constructor Description ByteArrayHashMap()
ByteArrayHashMap(int initialCapacity)
ByteArrayHashMap(int initialCapacity, float loadFactor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addEntry(int hash, byte[] key, T value, int bucketIndex)
void
clear()
boolean
containsKey(byte[] key)
(package private) void
createEntry(int hash, byte[] key, T value, int bucketIndex)
ByteArrayHashMap<T>
duplicate()
Bit inefficient at the momentprivate static boolean
eq(byte[] x, byte[] y)
T
get(byte[] key)
T
get(byte[] key, int offset, int len)
private static int
hash(byte[] x)
private static int
indexFor(int h, int length)
boolean
isEmpty()
java.util.List<byte[]>
keys()
T
put(byte[] key, T value)
T
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)
java.util.List<T>
values()
-
-
-
Field Detail
-
DEFAULT_INITIAL_CAPACITY
static final int DEFAULT_INITIAL_CAPACITY
The default initial capacity - MUST be a power of two.- See Also:
- Constant Field Values
-
MAXIMUM_CAPACITY
static final int MAXIMUM_CAPACITY
The 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:
- Constant Field Values
-
DEFAULT_LOAD_FACTOR
static final float DEFAULT_LOAD_FACTOR
- See Also:
- Constant Field Values
-
table
protected ByteArrayHashMap.Entry<T>[] table
-
size
protected int size
-
threshold
private int threshold
-
loadFactor
final float loadFactor
-
-
Method Detail
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
get
public T get(byte[] key, int offset, int len)
-
get
public T get(byte[] key)
-
containsKey
public boolean containsKey(byte[] key)
-
remove
public T remove(byte[] key)
-
clear
public void clear()
-
keys
public java.util.List<byte[]> keys()
-
values
public java.util.List<T> values()
-
duplicate
public ByteArrayHashMap<T> duplicate()
Bit inefficient at the moment- Returns:
-
resize
void resize(int newCapacity)
-
transfer
void transfer(ByteArrayHashMap.Entry<T>[] newTable)
-
removeEntryForKey
ByteArrayHashMap.Entry<T> removeEntryForKey(byte[] key)
-
addEntry
void addEntry(int hash, byte[] key, T value, int bucketIndex)
-
createEntry
void createEntry(int hash, byte[] key, T value, int bucketIndex)
-
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)
-
-