DEV Community

loading...

Discussion on: Iterator Pattern

Collapse
eidher profile image
eidher Author • Edited

forEach is a defult method of the Iterable interface which uses the java.util.Iterator interface. So, at the end of the day, implicitly is the same. Of course, we do not need to reinvent the wheel. I would use your code.