Fix the Problem
By now you’ve discovered that we need to decrement the iterator
i when removing an item from listToReduce. But
we can’t save changes to our code while a debugging session is in process. We first
terminate our debugging session, then fix the code.
-
In the Debug perspective of the Force.com IDE, click one of the top two levels
of the stack trace in the Debug pane.

-
To stop your debugging session, click the terminate icon (
).
-
To decrement the value of i after an account is removed from
listToReduce, modify
AccountViewerController.cls.

- Save your changes.
- Reload your Visualforce page: https://your_salesforce_instance/apex/AccountViewer
- Select Hide Cold Accounts.
- Celebrate! You’ve successfully debugged your code.