public class IntIntHashMap extends Object implements Cloneable, Iterable<IntIntHashMap.Entry>
IntObjectHashMap
,
IntLongHashMap
,
LongObjectHashMap
,
LongLongHashMap
,
LongIntHashMap
Modifier and Type | Class and Description |
---|---|
static class |
IntIntHashMap.Entry
An entry mapping a key to a value.
|
Constructor and Description |
---|
IntIntHashMap() |
IntIntHashMap(int initialCapacity) |
IntIntHashMap(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(int key) |
boolean |
containsValue(int value) |
int |
get(int 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<IntIntHashMap.Entry> |
iterator()
Returns a new
Iterator . |
int |
put(int key,
int value)
Maps the key to the specified value.
|
void |
putAll(IntIntHashMap source)
Copies all of the mappings from the specified map to this map.
|
int |
remove(int 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 IntIntHashMap()
public IntIntHashMap(int initialCapacity)
public IntIntHashMap(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(int key)
public int get(int key)
getKeyNotFoundValue()
if this map contains no mapping for the key.public int put(int key, int value)
getKeyNotFoundValue()
).public void putAll(IntIntHashMap source)
public int remove(int key)
getKeyNotFoundValue()
if no such mapping exists.public int size()
public int capacity()
public void clear()
public Iterator<IntIntHashMap.Entry> iterator()
Iterator
.
Note: this Iterator does not yet support removal of elements.iterator
in interface Iterable<IntIntHashMap.Entry>
public int setKeyNotFoundValue(int newKeyNotFoundValue)
get(int)
,
put(int, int)
public int getKeyNotFoundValue()
get(int)
,
put(int, int)
public StringBuilder toString(StringBuilder sb)
sb
- if null, a new StringBuilder is created