Android Studio generate foreach loop

By | September 14, 2015

Begin typing foreach until autocomplete pops up.  Select “Create a for each loop”.

You’ll then get an empty for each loop that you can start filling in, first supplying the Type of each object, a variable name of your choice for that object, then hit Enter to move to the name of the variable (a Collection), then hit Enter, then supply the statements you wish to run against each item within the collection.

android-studio-foreach-generate

android-studio-foreach-generate-example


Related Articles: