HashMap

Data / Composite

Description

A templated key-value map. In C++ Mode, std::map and std::unordered_map from the standard library are often more idiomatic, but HashMap is available for Processing Java compatibility.

Syntax

HashMap map map.put("key", 1) int v = map.get("key")

Parameters

None

Returns

HashMap

Methods

put(K k, V v)Inserts or updates a key-value pair
get(K k)Returns reference to value for key
containsKey(K k)Returns true if key exists
remove(K k)Removes a key-value pair
size()Returns number of entries
isEmpty()Returns true if empty
clear()Removes all entries
keySet()Returns a vector of all keys
values()Returns a vector of all values

Related

Under the Hood

Implementation in Processing.h / Processing.cpp:

Loading...