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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.