Maps are also known as dictionaries in other languages. Maps associate values with keys:

Maps have methods for putting key/value pairs in to the map, retrieving values by key, getting the count of items in the map, clearing all entries from the map, for getting sets of keys, sets of values, or sets of entries (key/value pairs). There are several implementations of the Map interface, the most commonly used is the HashMap. Maps store object, boxing or automatic wrapping must be used:

map = new HashMap();
map.put("red", "#ff0000");
map.put("green", "#00ff00");
map.put("blue", "#0000ff");

print(map.size());  // prints 3

if (map.containsKey("blue"))
   print(map.get("blue"));  // prints #0000ff

print(map.get("yellow"));  // prints null

for (String k : map.keySet())
   print(k);   // print keys in undefined order

for (String v : maps.values())
   print(v);   // print values in undefined order

for (Map.Entry me : maps.entrySet())
   print(me.getKey()+" is "+me.getValue());