Introducing more classes (Fingerprints and Policeman) and usage of more collections types (there are LinkedLists, HashSets, and HashMaps). None of my students gave me a more interesting story to make code about, so we continue with the stupid story of the students. This model builds upon example3.3, so if you did not see that yet, go back.

To make things interesting, we are going to have the students create a map to keep records on their experience. Recall a map means that you have a key object, and you insert something with that key. Then when you want the thing back, you give your key object and ask, politely :)

I've got a new class called Fingerprint and every student has one. Use the fingerprint as the key, and the student object as the thing in the map. Meet someone, note their fingerprint, and who they are. A student can get another's fingerprint, and then use that fingerprint to look up the student at some point in the future. Or, if somebody else says "whose fingerprint is this", then our students can check their records to see if they know who. Kinda like a distributed FBI criminal record check.

Now, who is doing the asking? A new class, Policeman, discovers a crime and finds a fingerprint at the scene. Then the policeman randomly checks with citizens to see if they know who did it.

The main method is in Test. Test's main method creates an instance of the Model class, and then the Model class is instructed to build objects and run a simulation.

All of the really important guts of the program are in Model, Student, and Policeman.

There should be a doc directory along with this code, and in there I have the browseable HTML javadoc output.