Map

util/map.ql

A HashMap wrapper that may store keys and values of any type.

Function Overview

Function Description
static fun fromList(list) Creates a new map from a list of key-value pairs.
native fun put(key, value) Puts a key and value into the map, overriding any previous value associated with the key.
native fun get(key) Gets a value from the map by its key .
native fun containsKey(key) Checks if the map contains the key key .
native fun containsValue(value) Checks if the map contains any entry with the value value .
native fun keys() Gets a list of all keys in the map.
native fun values() Gets a list of all values in the map.

Field Overview

Field Description
java _map

The internal HashMap object, storing the map's state.

Functions

static fun fromList(list) link

Creates a new map from a list of key-value pairs.

Params
list ( list )

A list of key-value pairs

Returns Map

A new map with the given key-value pairs

native fun put(key, value) link

Puts a key and value into the map, overriding any previous value associated with the key.

Params
key ( string )

The key to add into the map

value ( HashMap )

The value to be associated with the key

Errors

If the key is not found

native fun get(key) link

Gets a value from the map by its key .

Params
key

The key to look for

Returns

The value associated with the given key

Errors

If the key is not found

native fun containsKey(key) link

Checks if the map contains the key key .

Params
key

The key to look for

Returns boolean

true if the map contains the key, false if otherwise

native fun containsValue(value) link

Checks if the map contains any entry with the value value .

Params
value

The value to look for

Returns boolean

true if the map contains the value, false if otherwise

native fun keys() link

Gets a list of all keys in the map.

Returns list

A list of all keys in the map

native fun values() link

Gets a list of all values in the map.

Returns list

A list of all values in the map