a port of the Processing Visualization Language
Name

HashMap

Examples
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
initialCapacity int: defines the initial capacity of the map, it's 16 by default
loadFactor float: the load factor for the map, the default is 0.75
m Map: gives the new HashMap the same mappings as this Map
Usage Web & Application

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub