Maps
- Generalized form of an array; any object can be an index
- The type used for the index is the key; the type of value
being indexed is the value
-
Object get(Object key)
returns the value for a given key
-
Object put(Object key, Object value)
associates key with
value; if key is already in use, the value replaced is returned
- Maps are not Collections, strictly speaking, as they cannot
be iterated directly
- Set keySet() returns all of the keys of a Map as a Set, which is useful
for iteration because Map does not implement Collection or Iterable
- Implementations are
TreeMap
, HashMap
, and
LinkedHashMap
(next)