Android Studio Tip #5 – Autocomplete “for” statement

When you want to write a for statement most of you guys (or at least me :P) start to write character by character “for (int i = 0; i < list.size(); i++)”. Well Android Studio makes this easier for us and we can avoid writing that much by using a combination of 2 keys:


If you are inside a method and you want to generate a for statement you just have to press CTRL + J and select fori option from the dialog. You will just have to fill in the size of the list.



As you can see, there are more options from where you can choose. So you can generate iterators and other stuff, not just the for statement. So please feel free to try more of these options 😀

Exit mobile version