V - the value typefinal class IntIndexHashMap<V> extends java.util.AbstractCollection<V> implements IntIndexMap<V>
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
IntIndexHashMap.BranchIterator |
(package private) class |
IntIndexHashMap.EntryIterator |
(package private) class |
IntIndexHashMap.RowIterator |
(package private) static class |
IntIndexHashMap.Table<V> |
| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_INITIAL_CAPACITY |
private static float |
DEFAULT_LOAD_FACTOR |
private IntIndexer<? super V> |
indexer |
private int |
initialCapacity |
private float |
loadFactor |
private static int |
MAXIMUM_CAPACITY |
private static java.lang.Object |
NONEXISTENT
A non-existent table entry (as opposed to a
null value). |
private static java.lang.Object[] |
RESIZED
A row which has been resized into the new view.
|
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<IntIndexHashMap.Table> |
sizeUpdater |
private IntIndexHashMap.Table<V> |
table |
private static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<IntIndexHashMap,IntIndexHashMap.Table> |
tableUpdater |
private Equaller<? super V> |
ve |
| Constructor and Description |
|---|
IntIndexHashMap(IntIndexer<? super V> indexer)
Construct a new instance.
|
IntIndexHashMap(IntIndexer<? super V> indexer,
Equaller<? super V> valueEqualler)
Construct a new instance.
|
IntIndexHashMap(IntIndexer<? super V> indexer,
Equaller<? super V> valueEqualler,
int initialCapacity,
float loadFactor)
Construct a new instance.
|
IntIndexHashMap(IntIndexer<? super V> indexer,
float loadFactor)
Construct a new instance.
|
IntIndexHashMap(IntIndexer<? super V> indexer,
int initialCapacity)
Construct a new instance.
|
IntIndexHashMap(IntIndexer<? super V> indexer,
int initialCapacity,
float loadFactor)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(V v) |
private static <V> V[] |
addItem(V[] row,
V newItem) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsKey(int index)
Determine whether the given index is contained in the map.
|
private static <V> V[] |
createRow(int length) |
private static <V> V[] |
createRow(V newItem) |
private java.util.Iterator<V> |
createRowIterator(IntIndexHashMap.Table<V> table,
int rowIdx) |
private V |
doGet(IntIndexHashMap.Table<V> table,
int key) |
private V |
doPut(V value,
boolean ifAbsent,
IntIndexHashMap.Table<V> table) |
private V |
doRemove(int key,
IntIndexHashMap.Table<V> table) |
private boolean |
doRemove(V item,
IntIndexHashMap.Table<V> table) |
private V |
doReplace(V value,
IntIndexHashMap.Table<V> table) |
private boolean |
doReplace(V oldValue,
V newValue,
IntIndexHashMap.Table<V> table) |
V |
get(int index)
Get the value for the given index.
|
int |
getKey(V argument) |
java.util.Iterator<V> |
iterator() |
private static <V> V |
nonexistent() |
V |
put(V value)
Put a value into the map, replacing and returning any existing mapping.
|
V |
putIfAbsent(V value)
Put a value into the map if there is not already an existing mapping for it.
|
boolean |
remove(java.lang.Object value) |
private static <V> V[] |
remove(V[] row,
int idx) |
V |
removeKey(int index)
Remove and return a value for the given index.
|
V |
replace(V value)
Put a value into the map only if there is an existing mapping for it.
|
boolean |
replace(V oldValue,
V newValue)
Replace an old value with a new value.
|
private void |
resize(IntIndexHashMap.Table<V> origTable) |
private static <V> V[] |
resized() |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
addAll, containsAll, isEmpty, removeAll, retainAll, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprivate static final int DEFAULT_INITIAL_CAPACITY
private static final int MAXIMUM_CAPACITY
private static final float DEFAULT_LOAD_FACTOR
private static final java.lang.Object[] RESIZED
private static final java.lang.Object NONEXISTENT
null value).private final IntIndexer<? super V> indexer
private volatile IntIndexHashMap.Table<V> table
private final float loadFactor
private final int initialCapacity
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<IntIndexHashMap.Table> sizeUpdater
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<IntIndexHashMap,IntIndexHashMap.Table> tableUpdater
IntIndexHashMap(IntIndexer<? super V> indexer, Equaller<? super V> valueEqualler, int initialCapacity, float loadFactor)
indexer - the key indexervalueEqualler - the value equallerinitialCapacity - the initial capacityloadFactor - the load factorIntIndexHashMap(IntIndexer<? super V> indexer, Equaller<? super V> valueEqualler)
indexer - the key indexervalueEqualler - the value equallerIntIndexHashMap(IntIndexer<? super V> indexer, int initialCapacity, float loadFactor)
indexer - the key indexerinitialCapacity - the initial capacityloadFactor - the load factorIntIndexHashMap(IntIndexer<? super V> indexer, float loadFactor)
indexer - the key indexerloadFactor - the load factorIntIndexHashMap(IntIndexer<? super V> indexer, int initialCapacity)
indexer - the key indexerinitialCapacity - the initial capacityIntIndexHashMap(IntIndexer<? super V> indexer)
indexer - the key indexerpublic V putIfAbsent(V value)
IntIndexMapputIfAbsent in interface IntIndexMap<V>value - the value to addnull if the existing value was null or the value was added successfullypublic V removeKey(int index)
IntIndexMapremoveKey in interface IntIndexMap<V>index - the indexpublic boolean remove(java.lang.Object value)
remove in interface java.util.Collection<V>remove in interface IntIndexMap<V>remove in class java.util.AbstractCollection<V>public boolean containsKey(int index)
IntIndexMapcontainsKey in interface IntIndexMap<V>index - the indextrue if it is contained in the mappublic V get(int index)
IntIndexMapget in interface IntIndexMap<V>index - the indexpublic V put(V value)
IntIndexMapput in interface IntIndexMap<V>value - the value to addnull if the old value was null or was not presentpublic V replace(V value)
IntIndexMapreplace in interface IntIndexMap<V>value - the value to storenull) or null if there was no mapping to replacepublic boolean replace(V oldValue, V newValue)
IntIndexMapreplace in interface IntIndexMap<V>oldValue - the value to replacenewValue - the value to replace withtrue if the replacement succeeded, or false if the old value was not present in the mappublic int getKey(V argument)
getKey in interface IntIndexer<V>public boolean add(V v)
public <T> T[] toArray(T[] a)
public java.lang.Object[] toArray()
public boolean contains(java.lang.Object o)
public java.util.Iterator<V> iterator()
public int size()
private boolean doReplace(V oldValue, V newValue, IntIndexHashMap.Table<V> table)
private V doReplace(V value, IntIndexHashMap.Table<V> table)
private boolean doRemove(V item, IntIndexHashMap.Table<V> table)
private V doRemove(int key, IntIndexHashMap.Table<V> table)
private V doPut(V value, boolean ifAbsent, IntIndexHashMap.Table<V> table)
private void resize(IntIndexHashMap.Table<V> origTable)
private static <V> V[] remove(V[] row,
int idx)
private V doGet(IntIndexHashMap.Table<V> table, int key)
public void clear()
private static <V> V[] addItem(V[] row,
V newItem)
private static <V> V[] createRow(V newItem)
private static <V> V[] createRow(int length)
private static <V> V nonexistent()
private static <V> V[] resized()
private java.util.Iterator<V> createRowIterator(IntIndexHashMap.Table<V> table, int rowIdx)