Here we have an application that creates a Model, which acts
as a manager of a simulation. The Test class, where main
is located, is where you should look for the code that
does that. The Model's constructor needs
a number input to set the number of agents in the model.
The aModel object then is told to
buildObjects, which means
it dumps agents into a list. Then it runs the "checkAgents"
method, which just goes through the list of agents, telling
each to run its sayHi() method.
Please note, In the checkAgents method, I show 2 ways of
traversing through a collection using the Iterator. This is a vital
component of Java collections and everybody must master it.