Buggy code:
public class PlayPanel extends MapPanel implements FocusListener , KeyListener , Runnable { protected ArrayList < MovingGameObject > gameObjects ; public static final String chatFile = "DamaYamaChat.txt" ; ArrayList < Item > items ; ArrayList < MovingGameObject > toSpawn ; ArrayList < Player > players ; int playerIndex = 0 ; boolean [ ] [ ] allKeys ; boolean [ ] [ ] allPreviousKeys ; int [ ] directionX ; int [ ] directionY ; boolean started = false ; DamaYama frame ; public Player getPlayer ( ) { } public void close ( ) { } public void addToGameObjects ( MovingGameObject o ) { } public void removeFromGameObjects ( MovingGameObject o ) { } public PlayPanel ( DamaYama fram ) { } public boolean running = false ; static boolean anyRunning = false ; boolean stillPlaying = true ; static PlayPanel currentRunning ; public void tryClose ( ) { } public void run ( ) { } int timeSinceUpdate = 0 ; int timeSinceRepaint = 100 ; static final int normalMainSleepSpeed = 20 ; int mainSleepSpeed = 20 ; public void innerRun ( ) { } private boolean alivePlayerExists ( ) { } public void playerDied ( Player p ) { } protected void update ( ) { } public void updateSpawns ( ) { <START_BUG> for ( int i = 0 ; i < ( toSpawn . size ( ) ) ; i ++ ) <END_BUG> addGameObject ( toSpawn . remove ( i ) ) ; } public void updatePlayers ( ) { } JPanel innerPanel = new JPanel ( ) ; public void start ( ) { } protected void addGameObject ( MovingGameObject object ) { } public void focusGained ( FocusEvent arg0 ) { } public void focusLost ( FocusEvent e ) { } boolean [ ] keys = new boolean [ 14 ] ; boolean [ ] previousKeys = new boolean [ keys . length ] ; public static final int UP = 0 ; public static final int DOWN = 1 ; public static final int LEFT = 2 ; public static final int RIGHT = 3 ; public static final int SWITCH_WEAPON = 4 ; public static final int SHOOT = 5 ; public static final int JUMP = 6 ; public static final int ONE = 7 ; public static final int TWO = 8 ; public static final int THREE = 9 ; public static final int FOUR = 10 ; public static final int FIVE = 11 ; public static final int MANUAL_AIM = 12 ; public static final int BOMB = 13 ; boolean chatting = false ; String chatString = "" ; public void keyPressed ( KeyEvent e ) { } private void setKey ( int key , boolean value ) { } public void keyReleased ( KeyEvent e ) { } public void keyTyped ( KeyEvent e ) { } protected int newShootDirectionX ; protected int newShootDirectionY ; private void updateShootDirections ( MouseEvent e ) { } public void mousePressed ( MouseEvent e ) { } public void mouseDragged ( MouseEvent e ) { } public void mouseMoved ( MouseEvent e ) { } public void mouseWheelMoved ( MouseWheelEvent e ) { } public void mouseReleased ( MouseEvent e ) { } public void updateOffsets ( ) { } public static final double oldWeight = 0.95 ; public void drawSlant ( Graphics g ) { } public void drawTopDown ( Graphics g ) { } public int drawMessages ( Graphics g , int x , int y ) { } public static final int maxMessageTime = 200 ; ArrayList < PlayPanel . Message > messages = new ArrayList < PlayPanel . Message > ( ) ; int lastPlayerMessage = 0 ; static final String logout = "minimize" ; boolean immunity = false ; public void displayMessage ( String s , Color c ) { } public void displayMessage ( String s ) { } public boolean containsMessage ( String s ) { } public void addPlayerMessage ( int i , String s ) { } class MiniPanel extends JPanel implements ActionListener { PlayPanel play ; public MiniPanel ( PlayPanel p , JPanel panel ) { } public void actionPerformed ( ActionEvent arg0 ) { } } class Message { String message ; int time ; Color color ; public Message ( String item ) { } public Message ( String item , Color c ) { } } }

Fix:
for ( int i = ( toSpawn . size ( ) ) - 1 ; i >= 0 ; i -- )