Replace the usage of ListIterators in GameObject.java with foreach loops