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.
  1. In the Debug perspective of the Force.com IDE, click one of the top two levels of the stack trace in the Debug pane.
    Debug pane with callout showing top two levels of stack trace
  2. To stop your debugging session, click the terminate icon (Terminate icon).
  3. To decrement the value of i after an account is removed from listToReduce, modify AccountViewerController.cls.
    AccountViewerController.cls with i--; added to the end of its for loop's if statement
  4. Save your changes.
  5. Reload your Visualforce page: https://your_salesforce_instance/apex/AccountViewer
  6. Select Hide Cold Accounts.
  7. Celebrate! You’ve successfully debugged your code.