public class SimpleArrayMap
extends Object

   ↳<K, V>
Known Direct Subclasses

Base implementation of ArrayMap that doesn't include any standard Java container API interoperability. These features are generally heavier-weight ways to interact with the container, so discouraged, but they can be useful to make it easier to use as a drop-in replacement for HashMap. If you don't need them, this class can be preferrable since it doesn't bring in any of the implementation of those APIs, allowing that code to be stripped by ProGuard.


Public constructors


Create a new empty ArrayMap.

SimpleArrayMap(int capacity)

Create a new ArrayMap with a given initial capacity.

SimpleArrayMap(SimpleArrayMap<K, V> map)

Create a new ArrayMap with the mappings from the given ArrayMap.

Public methods

void clear()

Make the array map empty.

boolean containsKey(Object key)

Check whether a key exists in the array.

boolean containsValue(Object value)

Check whether a value exists in the array.

void ensureCapacity(int minimumCapacity)

Ensure the array map can hold at least minimumCapacity items.

boolean equals(Object object)

This implementation returns false if the object is not a Map or SimpleArrayMap, or if the maps have different sizes.

V get(Object key)

Retrieve a value from the array.

int hashCode()

int indexOfKey(Object key)

Returns the index of a key in the set.

boolean isEmpty()

Return true if the array map contains no items.

K keyAt(int index)

Return the key at the given index in the array.

V put(K key, V value)

Add a new value to the array map.

void putAll(SimpleArrayMap<? extends K, ? extends V> array)

Perform a put(Object, Object) of all key/value pairs in array

V remove(Object key)

Remove an existing key from the array map.

V removeAt(int index)

Remove the key/value mapping at the given index.

V setValueAt(int index, V value)

Set the value at a given index in the array.

int size()

Return the number of items in this array map.

String toString()

This implementation composes a string by iterating over its mappings.

V valueAt(int index)

Return the value at the given index in the array.

Inherited methods

From class java.lang.Object