Maps
In this section, we're going to take a look at Java's Map data structure. I wanted to start with a bunch of already formatted information, so I have created a little program on my own. You will find the following program in the companion files for the book. Take a look through it and make sure you understand how it works:
package maps;
import java.util.*;
public class Maps {
public static void main(String[] args) {
String[] allNames =
//<editor-fold desc="raw names data">
{"Jane", "Addams",
"Muhammad", "Ali",
"Stephen", "Ambrose",
"Louis", "Armstrong",
"Joan", "Baez",
"Josephine", "Baker",
"Eleanor", "Roosevelt",
"Frank", "Sinatra"
};
//</editor-fold>
String[] firstNames = new String[allNames.length/2];
String[] lastNames = new String[allNames.length/2];
for(int i = 0; i < allNames.length...