# AssociativeArray

#### new Cesium.AssociativeArray()
engine/Source/Core/AssociativeArray.js 10

A collection of key-value pairs that is stored as a hash for easy lookup but also provides an array for fast iteration.

### Members

#### length : number
engine/Source/Core/AssociativeArray.js 22

Gets the number of items in the collection.

#### values : Array
engine/Source/Core/AssociativeArray.js 35

Gets an unordered array of all values in the collection. This is a live array that will automatically reflect the values in the collection, it should not be modified directly.

### Methods

#### contains(key) → boolean
engine/Source/Core/AssociativeArray.js 48

Determines if the provided key is in the array.

Name | Type | Description
--- | --- | ---
`key` | string | number | The key to check.

##### Returns:

`true` if the key is in the array, `false` otherwise.

#### get(key) → *
engine/Source/Core/AssociativeArray.js 85

Retrieves the value associated with the provided key.

Name | Type | Description
--- | --- | ---
`key` | string | number | The key whose value is to be retrieved.

##### Returns:

The associated value, or undefined if the key does not exist in the collection.

#### remove(key) → boolean
engine/Source/Core/AssociativeArray.js 100

Removes a key-value pair from the collection.

Name | Type | Description
--- | --- | ---
`key` | string | number | The key to be removed.

##### Returns:

True if it was removed, false if the key was not in the collection.

#### removeAll()
engine/Source/Core/AssociativeArray.js 120

Clears the collection.

#### set(key, value)
engine/Source/Core/AssociativeArray.js 64

Associates the provided key with the provided value. If the key already exists, it is overwritten with the new value.

Name | Type | Description
--- | --- | ---
`key` | string | number | A unique identifier.
`value` | * | The value to associate with the provided key.

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.