public class LongIntHashMap extends Object implements Cloneable, Iterable<LongIntHashMap.Entry>
IntObjectHashMap
,
IntLongHashMap
,
LongObjectHashMap
,
LongLongHashMap
,
IntIntHashMap
Modifier and Type | Class and Description |
---|---|
static class |
LongIntHashMap.Entry
An entry mapping a key to a value.
|
Constructor and Description |
---|
LongIntHashMap() |
LongIntHashMap(int initialCapacity) |
LongIntHashMap(int initialCapacity,
float loadFactor) |
Modifier and Type | Method and Description |
---|---|
int |
capacity()
Returns the current capacity (buckets) in this map.
|
void |
clear()
Clears the entire map.
|
Object |
clone()
Disclaimer: If the value type doesn't implement
clone() , only the reference is copied. |
boolean |
containsKey(long key) |
boolean |
containsValue(int value) |
int |
get(long key)
Returns the value to which the specified key is mapped,
or
getKeyNotFoundValue() if this map contains no mapping for the key. |
int |
getKeyNotFoundValue()
Returns the value which is returned if no value has been found for the specified key.
|
Iterator<LongIntHashMap.Entry> |
iterator()
Returns a new
Iterator . |
int |
put(long key,
int value)
Maps the key to the specified value.
|
void |
putAll(LongIntHashMap source)
Copies all of the mappings from the specified map to this map.
|
int |
remove(long key)
Removes the key-value mapping from this map.
|
int |
setKeyNotFoundValue(int newKeyNotFoundValue)
Sets the new key not found value.
|
int |
size()
Returns the current number of key-value mappings in this map.
|
String |
toString() |
StringBuilder |
toString(StringBuilder sb) |
public LongIntHashMap()
public LongIntHashMap(int initialCapacity)
public LongIntHashMap(int initialCapacity, float loadFactor)
public Object clone()
clone()
, only the reference is copied.
Note: Due to private fields we cannot implement a copy constructor, sorry.public boolean containsValue(int value)
public boolean containsKey(long key)
public int get(long key)
getKeyNotFoundValue()
if this map contains no mapping for the key.public int put(long key, int value)
getKeyNotFoundValue()
).public void putAll(LongIntHashMap source)
public int remove(long key)
getKeyNotFoundValue()
if no such mapping exists.public int size()
public int capacity()
public void clear()
public Iterator<LongIntHashMap.Entry> iterator()
Iterator
.
Note: this Iterator does not yet support removal of elements.iterator
in interface Iterable<LongIntHashMap.Entry>
public int setKeyNotFoundValue(int newKeyNotFoundValue)
get(long)
,
put(long, int)
public int getKeyNotFoundValue()
get(long)
,
put(long, int)
public StringBuilder toString(StringBuilder sb)
sb
- if null, a new StringBuilder is created