Map type (joe)


A Joe Map is a Java Map, roughly equivalent to a Java HashMap. Maps created using the Map() initializer can contain any kind of Joe keys and values; the map need not be homogeneous. Maps received from Java code might be read-only or require a specific key/value types.

Static Methods

Initializer

Methods

Static Methods


Map.of()


Map.of(values...)

Creates a Map of the argument values, which must be a flat list of key/value pairs.

Map Initializer


Map([other]) → Map

Creates a new Map, optionally initializing it with the entries from the other map.

Methods


map.clear()


map.clear() → this

Empties the map.

map.containsKey()


map.containsKey(key) → Boolean

Returns true if the map contains the key, and false otherwise.

map.containsValue()


map.containsValue(value) → Boolean

Returns true if the map has at least one key with the given value, and false otherwise.

map.copy()


map.copy() → Map

Returns a shallow copy of this map.

map.get()


map.get(key) → value

Gets the key's value, or null if the key is not found.

map.getOrDefault()


map.getOrDefault(key, defaultValue) → value

Gets the key's value, or the defaultValue if the key is not found.

map.isEmpty()


map.isEmpty() → Boolean

Returns true if the map is empty, and false otherwise.

map.keySet()


map.keySet() → Set

Returns a set of the keys in the map.

map.put()


map.put(key, value) → value

Adds the *key/value pair to the map, returning the replaced value.

map.putAll()


map.putAll(map) → this

Adds the content of the map to this map.

map.remove()


map.remove(key) → value

Removes and returns the key's value, or null if the key wasn't found.

map.size()


map.size() → Number

Returns the number of key/value pairs in the map.

map.toString()


map.toString() → String

Returns the map's string representation.

map.values()


map.values() → List

Returns a list of the values in the map.