public final class HashMapIntObject<E> extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
HashMapIntObject.Entry<E>
An entry from the map
|
Constructor and Description |
---|
HashMapIntObject()
Create a map of default size
|
HashMapIntObject(int initialCapacity)
Create a map of given capacity
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all the existing mappings,
leaving the capacity unchanged.
|
boolean |
containsKey(int key)
find if key is present in map
|
Iterator<HashMapIntObject.Entry<E>> |
entries()
Iterate over all the map entries
|
E |
get(int key)
Retrieve the value corresponding to the key
|
int[] |
getAllKeys()
Get all the used keys
|
Object[] |
getAllValues()
Get all the values corresponding to the used keys.
|
<T> T[] |
getAllValues(T[] a)
Get all the values corresponding to the used keys.
|
boolean |
isEmpty()
Is the map empty
|
IteratorInt |
keys()
Get a way of iterating over the keys
|
E |
put(int key,
E value)
Add a mapping
|
E |
remove(int key)
Remove an mapping from the map
|
int |
size()
The number of mappings
|
Iterator<E> |
values()
Get a way of iterating over the values.
|
public HashMapIntObject()
public HashMapIntObject(int initialCapacity)
initialCapacity
- - can grow beyond thispublic E put(int key, E value)
key
- the keyvalue
- the corresponding valuepublic E remove(int key)
key
- the key to removepublic boolean containsKey(int key)
key
- the keypublic E get(int key)
key
- the keypublic int[] getAllKeys()
public Object[] getAllValues()
getAllValues(Object[])
for better type safety.public <T> T[] getAllValues(T[] a)
T
- the type of object this HashMap can store.a
- an array of the right type for the output, which will be used
if it is big enough, otherwise another array of this type will be allocated.public int size()
public boolean isEmpty()
public void clear()
public IteratorInt keys()
public Iterator<E> values()
public Iterator<HashMapIntObject.Entry<E>> entries()