public class Int2IntHashMap extends Object implements Map<Integer,Integer>, Serializable
| 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(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 |
computeIfAbsent(int key,
IntUnaryOperator mappingFunction)
Primitive specialised version of
Map.computeIfAbsent(Object, Function) |
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) |
int |
get(int key)
Get a value using provided key avoiding boxing.
|
Integer |
get(Object key) |
int |
hashCode() |
void |
intForEach(IntIntConsumer consumer)
Primitive specialised forEach implementation.
|
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 |
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(Map<? extends Integer,? extends Integer> map) |
int |
remove(int key)
Remove value from the map using given key avoiding boxing.
|
Integer |
remove(Object key) |
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) |
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, merge, putIfAbsent, remove, replace, replace, replaceAllpublic 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 int missingValue()
public float loadFactor()
public int capacity()
public int resizeThreshold()
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 void intForEach(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 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 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 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 associatedvalue - value to be associated with the specified keymissingValue() 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 associatedoldValue - value expected to be associated with the specified keynewValue - value to be associated with the specified keytrue if the value was replacedpublic boolean equals(Object o)
Copyright © 2014-2021 Real Logic Limited. All Rights Reserved.