class Flock { ArrayList boids; // An arraylist for all the boids Flock() { boids = new ArrayList(); // Initialize the arraylist } void run() { //for eaxh fish, apply the rest of the group to it. for (int i = 0; i < boids.size(); i++) { Boid b = (Boid) boids.get(i); b.run(boids); } } void addBoid(Boid b) { boids.add(b); } }