public final class HashMapObjectLong<E> extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
HashMapObjectLong.Entry<E>
An entry from the map
|
Constructor and Description |
---|
HashMapObjectLong()
Create a map of default size
|
HashMapObjectLong(int initialCapacity)
Create a map of given size
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all the existing mappings,
leaving the capacity unchanged.
|
boolean |
containsKey(E key)
find if key is present in map
|
Iterator<HashMapObjectLong.Entry<E>> |
entries()
Iterate over all the map entries
|
long |
get(E key)
Retrieve the value corresponding to the key
|
Object[] |
getAllKeys()
Get all the used keys.
|
<T> T[] |
getAllKeys(T[] a)
Get all the used keys.
|
long[] |
getAllValues()
Get all the values corresponding to the used keys.
|
boolean |
isEmpty()
Is the map empty
|
Iterator<E> |
keys()
Get a way of iterating over the keys
|
boolean |
put(E key,
long value)
Add a mapping
|
boolean |
remove(E key)
Remove an mapping from the map
|
int |
size()
The number of mappings
|
IteratorLong |
values()
Get a way of iterating over the values.
|
public HashMapObjectLong()
public HashMapObjectLong(int initialCapacity)
initialCapacity
- the initial capacity of the HashMappublic boolean put(E key, long value)
key
- the keyvalue
- the corresponding valuepublic boolean remove(E key)
key
- the key to removepublic boolean containsKey(E key)
key
- the keypublic long get(E key)
key
- the keyNoSuchElementException
- if the key is not foundpublic Object[] getAllKeys()
getAllKeys(Object[])
for better type safetypublic <T> T[] getAllKeys(T[] a)
T
- the type of the keysa
- 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 Iterator<E> keys()
public IteratorLong values()
public Iterator<HashMapObjectLong.Entry<E>> entries()
public long[] getAllValues()