org.eclipse.mat.collect

## Class HashMapIntObject<E>

- java.lang.Object
- - org.eclipse.mat.collect.HashMapIntObject<E>

All Implemented Interfaces:
  Serializable

    public final class HashMapIntObject<E>
    extends Object
    implements Serializable

A map from int to Object. More efficient than a general map

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static interface` `HashMapIntObject.Entry<E>` An entry from the map

### Constructor Summary

Constructors
Constructor and Description
`HashMapIntObject()` Create a map of default size
`HashMapIntObject(int initialCapacity)` Create a map of given capacity

### Method Summary

All Methods Instance Methods Concrete Methods
`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.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HashMapIntObject

    public HashMapIntObject()

Create a map of default size

#### HashMapIntObject

    public HashMapIntObject(int initialCapacity)

Create a map of given capacity

Parameters:
  `initialCapacity` - - can grow beyond this

### Method Detail

#### put

    public E put(int key,
                 E value)

Add a mapping

Parameters:
  `key` - the key
  `value` - the corresponding value
Returns:
  the old value if an entry with the key already exists

#### remove

    public E remove(int key)

Remove an mapping from the map

Parameters:
  `key` - the key to remove
Returns:
  the old value if the key was found, otherwise null

#### containsKey

    public boolean containsKey(int key)

find if key is present in map

Parameters:
  `key` - the key
Returns:
  true if the key was found

#### get

    public E get(int key)

Retrieve the value corresponding to the key

Parameters:
  `key` - the key
Returns:
  the value, or null if the key is not found

#### getAllKeys

    public int[] getAllKeys()

Get all the used keys

Returns:
  an array of the used keys

#### getAllValues

    public Object[] getAllValues()

Get all the values corresponding to the used keys. Duplicate values are possible if they correspond to different keys. Consider using `getAllValues(Object[])` for better type safety.

Returns:
  an array of the used values

#### getAllValues

    public <T> T[] getAllValues(T[] a)

Get all the values corresponding to the used keys. Duplicate values are possible if they correspond to different keys.

Parameters:
  `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.
Returns:
  an array of the used values

#### size

    public int size()

The number of mappings

Returns:
  the size of the map

#### isEmpty

    public boolean isEmpty()

Is the map empty

Returns:
  true if no current mappings

#### clear

    public void clear()

Remove all the existing mappings, leaving the capacity unchanged.

#### keys

    public IteratorInt keys()

Get a way of iterating over the keys

Returns:
  an iterator over the keys

#### values

    public Iterator<E> values()

Get a way of iterating over the values.

Returns:
  an iterator over the values

#### entries

    public Iterator<HashMapIntObject.Entry<E>> entries()

Iterate over all the map entries

Returns:
  the iterator over the entries