This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
| Name | HashMap |
||||||
|---|---|---|---|---|---|---|---|
| Examples |
import java.util.Iterator;
import java.util.Map;
HashMap hm = new HashMap();
hm.put("Ava", 1);
hm.put("Cait", 35);
hm.put("Casey", 36);
Iterator i = hm.entrySet().iterator(); // Get an iterator
while (i.hasNext()) {
Map.Entry me = (Map.Entry)i.next();
print(me.getKey() + " is ");
println(me.getValue());
}
| ||||||
| Description |
A HashMap stores a collection of objects, each referenced by a key. This is similar to an Array, only instead of accessing elements with a numeric index, a String is used. (If you are familiar with associative arrays from other languages, this is the same idea.) The above example covers basic use, but there's a more extensive example included with the Processing examples. For a list of the numerous HashMap features, please read the Java reference description. |
||||||
| Constructor | HashMap() HashMap(initialCapacity) HashMap(initialCapacity, loadFactor) HashMap(m) | ||||||
| Parameters |
|

