Maps

A map is a table that associates objects of one type (called keys) with objects of another type (called values). Java's Map interface is parameterized by the key and value types. Java provides several implementing classes:

jcf2

Example: Concordance.java

A concordance is a table that associates each word that occurs in a given text with its frequency (i.e., the number of times the word occurs in the text.)

Given the text "to be or not to be" our concordance produces the table:

WORD    FREQUENCY
be      2
or      1
to      2