Android Guides | Samples

Android.Util.ArrayMap Class

ArrayMap is a generic key->value mapping data structure that is designed to be more memory efficient than a traditional JavaDictionary.

See Also: ArrayMap

Syntax

[Android.Runtime.Register("android/util/ArrayMap", DoNotGenerateAcw=true)]
public sealed class ArrayMap : Object, IMap, IDisposable

Remarks

ArrayMap is a generic key->value mapping data structure that is designed to be more memory efficient than a traditional JavaDictionary. It keeps its mappings in an array data structure -- an integer array of hash codes for each item, and an Object array of the key/value pairs. This allows it to avoid having to create an extra object for every entry put in to the map, and it also tries to control the growth of the size of these arrays more aggressively (since growing them only requires copying the entries in the array, not rebuilding a hash map).

Note that this implementation is not intended to be appropriate for data structures that may contain large numbers of items. It is generally slower than a traditional HashMap, since lookups require a binary search and adds and removes require inserting and deleting entries in the array. For containers holding up to hundreds of items, the performance difference is not significant, less than 50%.

Because this container is intended to better balance memory use, unlike most other standard Java containers it will shrink its array as items are removed from it. Currently you have no control over this shrinking -- if you set a capacity and then remove an item, it may reduce the capacity to better match the current size. In the future an explicit call to set the capacity should turn off this aggressive shrinking behavior.

[Android Documentation]

Requirements

Namespace: Android.Util
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.Util.ArrayMap are listed below.

See Also: Object

Public Constructors

Create a new empty ArrayMap.
Create a new ArrayMap with the mappings from the given ArrayMap.
Create a new ArrayMap with a given initial capacity.

Public Properties

[read-only]
IsEmptyBoolean. Return true if the array map contains no items.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Clear()
Make the array map empty.
ContainsAll(ICollection<object>) : Boolean
ContainsKey(Object) : Boolean
Check whether a key exists in the array.
ContainsValue(Object) : Boolean
Check whether a value exists in the array.
EnsureCapacity(Int32)
Ensure the array map can hold at least minimumCapacity items.
EntrySet() : ICollection
Return a ISet for iterating over and interacting with all mappings in the array map.
Get(Object) : Object
Retrieve a value from the array.
IndexOfKey(Object) : Int32
Returns the index of a key in the set.
KeyAt(Int32) : Object
Return the key at the given index in the array.
KeySet() : ICollection
Return a ISet for iterating over and interacting with all keys in the array map.
Put(Object, Object) : Object
PutAll(ArrayMap)
PutAll(IDictionary)
Remove(Object) : Object
Remove an existing key from the array map.
RemoveAll(ICollection<object>) : Boolean
RemoveAt(Int32) : Object
Remove the key/value mapping at the given index.
RetainAll(ICollection<object>) : Boolean
SetValueAt(Int32, Object) : Object
Size() : Int32
Return the number of items in this array map.
ValueAt(Int32) : Object
Return the value at the given index in the array.
Values() : ICollection
Return a JavaCollection for iterating over and interacting with all values in the array map.