public class Long2LongHashMap extends Object implements Map<Long,Long>, Serializable
Modifier and Type | Class and Description |
---|---|
class |
Long2LongHashMap.EntryIterator
Iterator over entries which supports access to unboxed keys and values.
|
class |
Long2LongHashMap.EntrySet
Set of entries which supports optionally cached iterators to avoid allocation.
|
class |
Long2LongHashMap.KeyIterator
Iterator over keys which supports access to unboxed keys via
Long2LongHashMap.KeyIterator.nextValue() . |
class |
Long2LongHashMap.KeySet
Set of keys which supports optional cached iterators to avoid allocation.
|
class |
Long2LongHashMap.ValueCollection
Collection of values which supports optionally cached iterators to avoid allocation.
|
class |
Long2LongHashMap.ValueIterator
Iterator over values which supports access to unboxed values.
|
Constructor and Description |
---|
Long2LongHashMap(int initialCapacity,
float loadFactor,
long missingValue) |
Long2LongHashMap(int initialCapacity,
float loadFactor,
long missingValue,
boolean shouldAvoidAllocation) |
Long2LongHashMap(long missingValue) |
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.
|
long |
computeIfAbsent(long key,
LongUnaryOperator mappingFunction)
Primitive specialised version of
Map.computeIfAbsent(Object, Function) |
boolean |
containsKey(long key)
Long primitive specialised containsKey.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(long value)
Does the map contain the value.
|
boolean |
containsValue(Object value) |
Long2LongHashMap.EntrySet |
entrySet() |
boolean |
equals(Object o) |
void |
forEach(BiConsumer<? super Long,? super Long> action) |
long |
get(long key)
Get a value using provided key avoiding boxing.
|
Long |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Long2LongHashMap.KeySet |
keySet() |
float |
loadFactor()
Get the load factor applied for resize operations.
|
void |
longForEach(LongLongConsumer consumer)
Primitive specialised forEach implementation.
|
long |
maxValue()
Get the maximum value stored in the map.
|
long |
minValue()
Get the minimum value stored in the map.
|
long |
missingValue()
The value to be used as a null marker in the map.
|
long |
put(long key,
long value)
Put a key value pair in the map.
|
Long |
put(Long key,
Long value) |
void |
putAll(Map<? extends Long,? extends Long> map) |
long |
remove(long key)
Remove value from the map using given key avoiding boxing.
|
Long |
remove(Object key) |
long |
replace(long key,
long value)
Primitive specialised version of
Map.replace(Object, Object) |
boolean |
replace(long key,
long oldValue,
long 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() |
Long2LongHashMap.ValueCollection |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public Long2LongHashMap(long missingValue)
missingValue
- for the map that represents null.public Long2LongHashMap(int initialCapacity, float loadFactor, long missingValue)
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.public Long2LongHashMap(int initialCapacity, float loadFactor, long 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 long missingValue()
public float loadFactor()
public int capacity()
public int resizeThreshold()
public long get(long key)
key
- lookup key.missingValue()
if key is not found in the map.public long put(long key, long value)
key
- lookup keyvalue
- new value, must not be missingValue()
missingValue()
if none foundIllegalArgumentException
- if value is missingValue()
public void longForEach(LongLongConsumer 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(long key)
key
- the key to check.public boolean containsValue(long value)
value
- to be tested against contained values.public void compact()
public long computeIfAbsent(long key, LongUnaryOperator mappingFunction)
Map.computeIfAbsent(Object, Function)
key
- to search on.mappingFunction
- to provide a value if the get returns null.public void forEach(BiConsumer<? super Long,? super Long> action)
public boolean containsKey(Object key)
containsKey
in interface Map<Long,Long>
public boolean containsValue(Object value)
containsValue
in interface Map<Long,Long>
public Long2LongHashMap.KeySet keySet()
public Long2LongHashMap.ValueCollection values()
public Long2LongHashMap.EntrySet entrySet()
public long remove(long key)
key
- whose mapping is to be removed from the map.missingValue()
if key was not found in the map.public long minValue()
missingValue()
public long maxValue()
missingValue()
public long replace(long key, long 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(long key, long oldValue, long 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.