public class Int2IntHashMap
extends java.lang.Object
implements java.util.Map<java.lang.Integer,java.lang.Integer>, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
class |
Int2IntHashMap.EntryIterator |
class |
Int2IntHashMap.EntrySet |
class |
Int2IntHashMap.KeyIterator |
class |
Int2IntHashMap.KeySet |
class |
Int2IntHashMap.ValueCollection |
class |
Int2IntHashMap.ValueIterator |
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,
java.util.function.IntUnaryOperator mappingFunction)
Primitive specialised version of
Map.computeIfAbsent(Object, Function) |
boolean |
containsKey(int key)
Int primitive specialised containsKey.
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(int value)
Does the map contain the value.
|
boolean |
containsValue(java.lang.Object value) |
Int2IntHashMap.EntrySet |
entrySet() |
boolean |
equals(java.lang.Object o) |
void |
forEach(java.util.function.BiConsumer<? super java.lang.Integer,? super java.lang.Integer> action) |
int |
get(int key) |
java.lang.Integer |
get(java.lang.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.
|
java.lang.Integer |
put(java.lang.Integer key,
java.lang.Integer value) |
int |
put(int key,
int value)
Put a key value pair into the map.
|
void |
putAll(java.util.Map<? extends java.lang.Integer,? extends java.lang.Integer> map) |
int |
remove(int key) |
java.lang.Integer |
remove(java.lang.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() |
java.lang.String |
toString() |
Int2IntHashMap.ValueCollection |
values() |
public Int2IntHashMap(int missingValue)
public Int2IntHashMap(int initialCapacity, float loadFactor, int missingValue)
public Int2IntHashMap(int initialCapacity, float loadFactor, int missingValue, boolean shouldAvoidAllocation)
initialCapacity
- for the map to override MIN_CAPACITY
loadFactor
- 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 size()
size
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public int get(int key)
public int put(int key, int value)
key
- lookup keyvalue
- new value, must not be initialValuejava.lang.IllegalArgumentException
- if value is missingValuepublic void intForEach(IntIntConsumer consumer)
NB: Renamed from forEach to avoid overloading on parameter types of lambda expression, which doesn't interplay 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 clear()
clear
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public void compact()
public int computeIfAbsent(int key, java.util.function.IntUnaryOperator mappingFunction)
Map.computeIfAbsent(Object, Function)
key
- to search on.mappingFunction
- to provide a value if the get returns null.public java.lang.Integer get(java.lang.Object key)
get
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public java.lang.Integer put(java.lang.Integer key, java.lang.Integer value)
put
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public void forEach(java.util.function.BiConsumer<? super java.lang.Integer,? super java.lang.Integer> action)
forEach
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public void putAll(java.util.Map<? extends java.lang.Integer,? extends java.lang.Integer> map)
putAll
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public Int2IntHashMap.KeySet keySet()
keySet
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public Int2IntHashMap.ValueCollection values()
values
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public Int2IntHashMap.EntrySet entrySet()
entrySet
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public java.lang.Integer remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
public int remove(int key)
public int minValue()
missingValue()
public int maxValue()
missingValue()
public java.lang.String toString()
toString
in class java.lang.Object
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(java.lang.Object o)
equals
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Map<java.lang.Integer,java.lang.Integer>
hashCode
in class java.lang.Object
Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.