I have seen this kind of for-loop around but I don't quite understand it. Can someone explain how it works?
Example from the link:
public static void printPersonsWithinAgeRange(
List<Person> roster, int low, int high) {
for (Person p : roster) {
if (low <= p.getAge() && p.getAge() < high) {
p.printPerson();
}
}
}
EDIT: question already answered here: How does the Java 'for each' loop work?.
EDIT 2: Oracle tutorial: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html