Skip to content

KBE3D / KBCore / Cesium / AssociativeArray

类: AssociativeArray

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

属性

length

length: number

Gets the number of items in the collection.


values

values: any[]

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.

方法

contains()

contains(key: string | number): boolean

Determines if the provided key is in the array.

参数

key

The key to check.

string | number

返回

boolean

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


set()

set(key: string | number, value: any): void

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

参数

key

A unique identifier.

string | number

value

any

The value to associate with the provided key.

返回

void


get()

get(key: string | number): any

Retrieves the value associated with the provided key.

参数

key

The key whose value is to be retrieved.

string | number

返回

any

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


remove()

remove(key: string | number): boolean

Removes a key-value pair from the collection.

参数

key

The key to be removed.

string | number

返回

boolean

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


removeAll()

removeAll(): void

Clears the collection.

返回

void

构造函数

构造函数

new AssociativeArray(): AssociativeArray

返回

AssociativeArray

KBE3D @3.0.0 Copyright © 2024-present KBE3D