| Modifier and Type | Class and Description |
|---|---|
class |
Int2IntHashMap.EntryIterator
Iterator over entries which supports access to unboxed keys and values.
|
class |
Int2IntHashMap.EntrySet
Set of entries which supports optionally cached iterators to avoid allocation.
|
class |
Int2IntHashMap.KeyIterator
Iterator over keys which supports access to unboxed keys via
Int2IntHashMap.KeyIterator.nextValue(). |
class |
Int2IntHashMap.KeySet
Set of keys which supports optional cached iterators to avoid allocation.
|
class |
Int2IntHashMap.ValueCollection
Collection of values which supports optionally cached iterators to avoid allocation.
|
class |
Int2IntHashMap.ValueIterator
Iterator over values which supports access to unboxed values.
|
| Constructor and Description |
|---|
Int2IntHashMap(int missingValue) |
Int2IntHashMap(Int2IntHashMap mapToCopy)
Copy construct a new map from an existing one.
|
Int2IntHashMap(int initialCapacity,
float loadFactor,
int missingValue) |
Int2IntHashMap(int initialCapacity,
float loadFactor,
int missingValue,
boolean shouldAvoidAllocation) |
| Modifier and Type | Method and Description |
|---|---|
int |
capacity()
Get the total capacity for the map to which the load factor will be a fraction of.
|
void |
clear() |
void |
compact()
Compact the backing arrays by rehashing with a capacity just larger than current size
and giving consideration to the load factor.
|
int |
compute(int key,
IntBinaryOperator remappingFunction)
Primitive specialised version of
Map.compute(Object, BiFunction). |
int |
computeIfAbsent(int key,
IntUnaryOperator mappingFunction)
Primitive specialised version of
Map.computeIfAbsent(Object, Function). |
int |
computeIfPresent(int key,
IntBinaryOperator remappingFunction)
Primitive specialised version of
Map.computeIfPresent(Object, BiFunction). |
boolean |
containsKey(int key)
Int primitive specialised containsKey.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(int value)
Does the map contain the value.
|
boolean |
containsValue(Object value) |
Int2IntHashMap.EntrySet |
entrySet() |
boolean |
equals(Object o) |
void |
forEach(BiConsumer<? super Integer,? super Integer> action) |
void |
forEachInt(IntIntConsumer consumer)
Primitive specialised forEach implementation.
|
int |
get(int key)
Get a value using provided key avoiding boxing.
|
Integer |
get(Object key) |
int |
getOrDefault(int key,
int defaultValue)
Returns the value to which the specified key is mapped, or
defaultValue if this map contains no mapping for the key. |
int |
hashCode() |
void |
intForEach(IntIntConsumer consumer)
Deprecated.
Use
forEachInt(IntIntConsumer) instead. |
boolean |
isEmpty() |
Int2IntHashMap.KeySet |
keySet() |
float |
loadFactor()
Get the load factor applied for resize operations.
|
int |
maxValue()
Get the maximum value stored in the map.
|
int |
merge(int key,
int value,
IntIntFunction remappingFunction)
Primitive specialised version of
Map.merge(Object, Object, BiFunction). |
int |
minValue()
Get the minimum value stored in the map.
|
int |
missingValue()
The value to be used as a null marker in the map.
|
Integer |
put(Integer key,
Integer value) |
int |
put(int key,
int value)
Put a key value pair in the map.
|
void |
putAll(Int2IntHashMap map)
Put all values from the given map into this map without allocation.
|
void |
putAll(Map<? extends Integer,? extends Integer> map) |
Integer |
putIfAbsent(Integer key,
Integer value) |
int |
putIfAbsent(int key,
int value)
Primitive specialised version of
Map.putIfAbsent(Object, Object) method. |
int |
remove(int key)
Remove value from the map using given key avoiding boxing.
|
boolean |
remove(int key,
int value)
Primitive specialised version of
Map.remove(Object, Object). |
Integer |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
Integer |
replace(Integer key,
Integer value) |
boolean |
replace(Integer key,
Integer oldValue,
Integer newValue) |
int |
replace(int key,
int value)
Primitive specialised version of
Map.replace(Object, Object). |
boolean |
replace(int key,
int oldValue,
int newValue)
Primitive specialised version of
Map.replace(Object, Object, Object). |
void |
replaceAll(BiFunction<? super Integer,? super Integer,? extends Integer> function) |
void |
replaceAllInt(IntIntFunction function)
Primitive specialised version of
Map.replaceAll(BiFunction). |
int |
resizeThreshold()
Get the actual threshold which when reached the map will resize.
|
int |
size() |
String |
toString() |
Int2IntHashMap.ValueCollection |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, getOrDefault, mergepublic Int2IntHashMap(int missingValue)
missingValue - for the map that represents null.public Int2IntHashMap(int initialCapacity,
float loadFactor,
int missingValue)
initialCapacity - for the map to override MIN_CAPACITYloadFactor - for the map to override Hashing.DEFAULT_LOAD_FACTOR.missingValue - for the map that represents null.public Int2IntHashMap(int initialCapacity,
float loadFactor,
int missingValue,
boolean shouldAvoidAllocation)
initialCapacity - for the map to override MIN_CAPACITYloadFactor - for the map to override Hashing.DEFAULT_LOAD_FACTOR.missingValue - for the map that represents null.shouldAvoidAllocation - should allocation be avoided by caching iterators and map entries.public Int2IntHashMap(Int2IntHashMap mapToCopy)
mapToCopy - for construction.public int missingValue()
public float loadFactor()
public int capacity()
public int resizeThreshold()
public int getOrDefault(int key,
int defaultValue)
defaultValue if this map contains no mapping for the key.key - whose associated value is to be returned.defaultValue - to be returned if there is no value in the map for a given key.defaultValue if this map contains no mapping for the key.public int get(int key)
key - lookup key.missingValue() if key is not found in the map.public int put(int key,
int value)
key - lookup keyvalue - new value, must not be missingValue()missingValue() if none foundIllegalArgumentException - if value is missingValue()public int putIfAbsent(int key,
int value)
Map.putIfAbsent(Object, Object) method.key - key with which the specified value is to be associatedvalue - value to be associated with the specified keymissingValue() if there was no mapping for the key.IllegalArgumentException - if value is missingValue()@Deprecated public void intForEach(IntIntConsumer consumer)
forEachInt(IntIntConsumer) instead.forEachInt(IntIntConsumer) instead.consumer - a callback called for each key/value pair in the map.forEachInt(IntIntConsumer)public void forEachInt(IntIntConsumer consumer)
NB: Renamed from forEach to avoid overloading on parameter types of lambda expression, which doesn't play well with type inference in lambda expressions.
consumer - a callback called for each key/value pair in the map.public boolean containsKey(int key)
key - the key to check.public boolean containsValue(int value)
value - to be tested against contained values.public void compact()
public int computeIfAbsent(int key,
IntUnaryOperator mappingFunction)
Map.computeIfAbsent(Object, Function).key - to search on.mappingFunction - to provide a value if the get returns null.public int computeIfPresent(int key,
IntBinaryOperator remappingFunction)
Map.computeIfPresent(Object, BiFunction).key - to search on.remappingFunction - to compute a value if a mapping is found.public int compute(int key,
IntBinaryOperator remappingFunction)
Map.compute(Object, BiFunction).key - to search on.remappingFunction - to compute a value.public void forEach(BiConsumer<? super Integer,? super Integer> action)
public boolean containsKey(Object key)
containsKey in interface Map<Integer,Integer>public boolean containsValue(Object value)
containsValue in interface Map<Integer,Integer>public void putAll(Int2IntHashMap map)
map - whose value are to be added.public Integer putIfAbsent(Integer key, Integer value)
putIfAbsent in interface Map<Integer,Integer>public void replaceAll(BiFunction<? super Integer,? super Integer,? extends Integer> function)
replaceAll in interface Map<Integer,Integer>public Int2IntHashMap.KeySet keySet()
public Int2IntHashMap.ValueCollection values()
public Int2IntHashMap.EntrySet entrySet()
public int remove(int key)
key - whose mapping is to be removed from the map.missingValue() if key was not found in the map.public boolean remove(int key,
int value)
Map.remove(Object, Object).key - with which the specified value is associated.value - expected to be associated with the specified key.true if the value was removed.public int merge(int key,
int value,
IntIntFunction remappingFunction)
Map.merge(Object, Object, BiFunction).key - with which the resulting value is to be associated.value - to be merged with the existing value associated with the key or, if no existing value or a null
value is associated with the key, to be associated with the key.remappingFunction - the function to recompute a value if present.missingValue() if no value is associated
with the key as the result of this operation.public int minValue()
missingValue().public int maxValue()
missingValue().public int replace(int key,
int value)
Map.replace(Object, Object).key - key with which the specified value is associated.value - value to be associated with the specified key.missingValue() if there was no mapping for the key.public boolean replace(int key,
int oldValue,
int newValue)
Map.replace(Object, Object, Object).key - key with which the specified value is associated.oldValue - value expected to be associated with the specified key.newValue - value to be associated with the specified key.true if the value was replaced.public void replaceAllInt(IntIntFunction function)
Map.replaceAll(BiFunction).
NB: Renamed from replaceAll to avoid overloading on parameter types of lambda expression, which doesn't play well with type inference in lambda expressions.
function - to apply to each entry.public boolean equals(Object o)
Copyright © 2014-2022 Real Logic Limited. All Rights Reserved.