Type: Map

From Waltz
Jump to navigation Jump to search

The Map type represents a set of data with a specific key for each value, unlike a List.

Maps allow you to pass multiple values between nodes with meaningful names for each value, where otherwise only a single value would connectable.

The keys in a Map are always strings.

Throughout the Waltz documentation, it is common to see a Map expressed with a diamond operator as Map<type>, which means that the contents of the Map are expected to be of the type inside the diamond operator. Some maps may be Map<Any> which is sometimes shortened to simply Map.

Some applications and programming languages refer to this type as a Dictionary or Key-Value pair.


There is no special constructor for creating a Map. Instead, use the Map Node to create a map.

Collection Access

As Map is a collection type, it has special treatment for getting and setting values using the bracket notation.

To set the value named bestNumber in a map named bestThings to 42 you would write:

bestThings["bestNumber"] = 42;

Because our key is also a valid identifier in JavaScript (see Grammar) we can also set the value with the following expression:

bestThings.bestNumber = 42;

To print the value present at the key bestAnimal of the map to the Console you would write:





There are no parameters exposed by this type.


Arguments Returns Details
clear() Void Removes all of the key-value pairs in this map.
containsKey(key) String key - The key for which to check for a value. Boolean Checks if a value is present in the map for the provided key.
containsValue(value) Any value - The value for which to check. Boolean Checks if the provided value is present in the map.
equals(map) Map map - The map against which to compare equality. Boolean Returns true if this map and the provided map are identical.
get(key) String key - The key for which to get a value. Any Gets the values stored at the provided key.
isEmpty() Boolean Returns true if there are no key-value pairs in this map.
keySet() List<String> Returns a list of keys present in the map without their values.
put(key, value) String key - The key at which to place the new value.

Any value - The value to place at the specified key.

Any Puts the new value at the specified key, and returns the value previously stored at that key if one is present.
putAll(map) Map map - The map from which to insert all key-value pairs. Void Puts all the key-value pairs in the provided map into this map.
remove(key) String key - The key for the key-value pair to remove from the map. Any Removes the specified key from the Map, returning the value previously held at that key.
size() Number Returns the number of key-value pairs in the map.
values() List Returns a list of values present in the map without their keys.
Primitives Boolean · Number · String
Objects Color · Dimension · DmxMultiverse · DmxUniverse · LocalInterface · Material · Point · RemoteAddress/IP · Scene · Time · Touch
Node Specific NdiSource · WoControlCue · WoHitTestResult · WoTimeline
Collections List · List of Lists · Map · Varargs
Special Any · Consumer · Expression · Null · Void