V
- type of the object stored in the map.public class BiInt2ObjectMap<V>
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
BiInt2ObjectMap.EntryConsumer<V>
Handler for a map entry
|
static interface |
BiInt2ObjectMap.EntryFunction<V>
Creates new values based upon keys
|
Constructor and Description |
---|
BiInt2ObjectMap()
Construct an empty map
|
BiInt2ObjectMap(int initialCapacity,
float loadFactor)
Construct a map that sets it initial capacity and load factor.
|
Modifier and Type | Method and Description |
---|---|
int |
capacity()
Get the total capacity for the map to which the load factor with be a fraction of.
|
void |
clear()
Clear out the map of all entries.
|
void |
compact()
Compact the backing arrays by rehashing with a capacity just larger than current size
and giving consideration to the load factor.
|
V |
computeIfAbsent(int keyPartA,
int keyPartB,
BiInt2ObjectMap.EntryFunction<? extends V> mappingFunction)
If the specified key is not already associated with a value (or is mapped
to
null ), attempts to compute its value using the given mapping
function and enters it into this map unless null . |
void |
forEach(BiInt2ObjectMap.EntryConsumer<V> consumer)
Iterate over the contents of the map
|
void |
forEach(java.util.function.Consumer<V> consumer)
Iterate over the contents of the map
|
V |
get(int keyPartA,
int keyPartB)
Retrieve a value from the map.
|
boolean |
isEmpty()
Is map empty or not.
|
float |
loadFactor()
Get the load factor beyond which the map will increase size.
|
V |
put(int keyPartA,
int keyPartB,
V value)
Put a value into the map.
|
V |
remove(int keyPartA,
int keyPartB)
Remove a value from the map and return the value.
|
int |
resizeThreshold()
Get the actual threshold which when reached the map will resize.
|
int |
size()
Return the number of unique entries in the map.
|
java.lang.String |
toString() |
public BiInt2ObjectMap()
public BiInt2ObjectMap(int initialCapacity, float loadFactor)
initialCapacity
- for the underlying hash maploadFactor
- for the underlying hash mappublic int capacity()
public float loadFactor()
public int resizeThreshold()
public void clear()
public void compact()
public V put(int keyPartA, int keyPartB, V value)
keyPartA
- for the keykeyPartB
- for the keyvalue
- to put into the mappublic V get(int keyPartA, int keyPartB)
keyPartA
- for the keykeyPartB
- for the keypublic V remove(int keyPartA, int keyPartB)
keyPartA
- for the keykeyPartB
- for the keypublic V computeIfAbsent(int keyPartA, int keyPartB, BiInt2ObjectMap.EntryFunction<? extends V> mappingFunction)
null
), attempts to compute its value using the given mapping
function and enters it into this map unless null
.keyPartA
- for the keykeyPartB
- for the keymappingFunction
- creates values based upon keys if the key pair is missingpublic void forEach(java.util.function.Consumer<V> consumer)
consumer
- to apply to each value in the mappublic void forEach(BiInt2ObjectMap.EntryConsumer<V> consumer)
consumer
- to apply to each value in the mappublic int size()
public boolean isEmpty()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014-2019 Real Logic Ltd. All Rights Reserved.