This is the first time that I\'ve seen this kind of syntax :
// class Node
public class Node {
...
...
}
public class Otherclass { ... }
Otherclass gra
It is called Enhanced for-loop. It basically iterates over a Collection by fetching each element in sequence. So you don't need to access elements on index.
List list = new ArrayList();
for (int val: list) {
System.out.println(val); // Prints each value from list
}
See §14.14.2 - Enhanced for loop section of Java Language Specification.