public final class HashMapLongObject<E> extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
HashMapLongObject.Entry<E>
An entry from the map
|
Constructor and Description |
---|
HashMapLongObject()
Create a map of default size
|
HashMapLongObject(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(long key)
find if key is present in map
|
Iterator<HashMapLongObject.Entry<E>> |
entries()
Iterate over all the map entries
|
E |
get(long key)
Retrieve the value corresponding to the key
|
long[] |
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
|
IteratorLong |
keys()
Get a way of iterating over the keys
|
E |
put(long key,
E value)
Add a mapping
|
E |
remove(long 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 HashMapLongObject()
public HashMapLongObject(int initialCapacity)
initialCapacity
- - can grow beyond thispublic E put(long key, E value)
key
- the keyvalue
- the corresponding valuepublic E remove(long key)
key
- the key to removepublic boolean containsKey(long key)
key
- the keypublic E get(long key)
key
- the keypublic long[] getAllKeys()
public Object[] getAllValues()
getAllValues(Object[])
for better type safety.public <T> T[] getAllValues(T[] a)
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 IteratorLong keys()
public Iterator<E> values()
public Iterator<HashMapLongObject.Entry<E>> entries()