Compare Java external iterators with callback- or stream-style internal iteration so traversal control stays intentional.
Java supports both external and internal iteration styles.
The caller pulls elements:
IteratorforThis style is strong when the caller needs fine control over stopping, branching, or state.
The collection or pipeline drives traversal:
This style is strong when the operation can be expressed declaratively.
Choose the iteration style that makes control flow clearest. If the caller needs to own traversal decisions, external iteration is often better.