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