Why is this loop only running once
<p>The following for loop (<code>for (int curr = 0; curr&lt;working.size(); curr++){</code>) loop should run n times, where n is the size of the ArrayList called working. However, even after verifying that the ArrayList has multiple elements in it, the loop only runs once. Why is this? </p>

<pre><code> String sql = "SELECT time FROM `tutors`.`appointments`"
            + "WHERE tutorID = ? AND date = ?";

          try{
    for (int curr = 0; curr&lt;working.size(); curr++){       
        System.out.println("working size: " + working.size());
        System.out.println("running for the time: " + curr);

        PreparedStatement ps = conn.prepareStatement(sql);
        ps.setInt(1, working.get(curr).getTutorID());
        ps.setDate(2, toReturn);

        ResultSet rs = ps.executeQuery();

        while(rs.next()){
            Time t = rs.getTime("time");
            System.out.println("RS HAS : " + t);
            long beforeLong = t.getTime()-900000;
            long afterLong = t.getTime()+900000;

            Time beforeTime = new Time(beforeLong);
            Time afterTime = new Time(afterLong);

            if (!time.before(beforeTime) &amp;&amp; !time.after(afterTime)){
                System.out.println("removed" + working.get(curr).getName());
                working.remove(curr);
            }
        } 
    }
        } catch(SQLException e) {e.printStackTrace();}
</code></pre>

<p>PS - I have the same problem whether I put the try/catch inside the for loop or outside of it.</p>
