You can use a foreach loop here.  IntelliJ should be giving you a warning.