Use for-int loops to avoid allocating iterators

This is just a refactoring CL, no feature flag is required.

Bug: 309837937
Test: preubmit
Change-Id: If507d7f6b79afdee7da44647e41e35b76348a567
2 files changed