11.9. Maps

The Map replaces the Dictionary class. Dictionary used to be the superclass of any implementation that paired keys with values in the manner of a ColdFusion structure. There are many different kinds of maps, but only two that are used with much frequency. The most popular maps are HashMap and TreeMap, which we will look at here.

The following things are true of Maps.

  • Maps store key-value pairs called entries.

  • Each key must be unique within a Map, and any entry may point to only one value.

  • The key and the value can be of any object type. That is, you cannot store primitive types.

  • The Map interface offers three collection views: as a set of keys (keySet()), as a collection of values (values()), or as a set of key-value mappings (entrySet() ...

Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.