import java.awt.event.KeyEvent;
import java.util.ArrayList;

/* This class is to handle input from the user. A given class must implement the 
 * inputResponder interface in order to register, and unregister user controls.
 */
public class InputHandler implements InputResponder {

	private ArrayList<InputResponder> inputResponders;

	InputHandler() {
		inputResponders = new ArrayList<InputResponder>();
	}

	public void registerInputResponder(InputResponder i) {
		inputResponders.add(i);
	}

	public void unregisterInputResponder(InputResponder inResponder) {
		for (int i = 0; i < this.inputResponders.size(); i++) {
			if (inputResponders.get(i) == inResponder) {
				inputResponders.remove(i);
				i--;
			}
		}
	}

	public void keyDownResponse(KeyEvent e) {
		if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
			System.exit(0);

		for (InputResponder ir : inputResponders) {
			ir.keyDownResponse(e);
		}
	}

	public void keyUpResponse(KeyEvent e) {
		for (InputResponder ir : inputResponders) {
			ir.keyUpResponse(e);
		}
	}

}

@@ -137,17 +137,16 @@
 ment the
- 
 %0D%0A * inp
@@ -860,36 +860,71 @@
 %0A%09%09for (
-InputResponder ir : 
+int i = 0; i %3C this.inputResponders.size(); i++) %7B%0D%0A%09%09%09
 inputRes
@@ -926,34 +926,31 @@
 utResponders
-) %7B%0D%0A%09%09%09ir
+.get(i)
 .keyDownResp
@@ -1023,28 +1023,63 @@
 or (
-InputResponder ir : 
+int i = 0; i %3C this.inputResponders.size(); i++) %7B%0D%0A%09%09%09
 inpu
@@ -1093,18 +1093,15 @@
 ders
-) %7B%0D%0A%09%09%09ir
+.get(i)
 .key

Fix concurrency issue in InputHandler.