It follows Iterator design pattern.
Iterator Pattern is a type of behavioral pattern.
The Iterator pattern is one, which allows you to navigate through a collection of data using a common interface without knowing about the underlying implementation.
Iterator should be implemented as an interface. This allows the user to implement it anyway its easier for him/her to return data.
Example of Iteration design pattern - Enumeration The class java.util.Enumeration is an example of the Iterator pattern.