Maps 1, Preparations
Read the introduction on Java Collections - Map and Java Collections - SortedMap.
Consider the following array of person names:
Figure 577. An array of strings
key | value |
---|---|
0 | "Eve" |
1 | "Tim" |
2 | "Rick" |
3 | "June" |
4 | "Phyllis" |
Set of keys: {0, 1, 2, 3, 4}
Consider the following array describing (non leap year) month lengths:
Figure 578. An associative array describing month lengths
key | value |
---|---|
"January" |
31 |
"February" |
28 |
"March" |
31 |
... | ... |
"December" |
31 |
Set of keys: {"January"
, "February"
,
"March"
, ..., "December"
}