Compare Visitor and Iterator in Java so traversal and operation-separation concerns are not treated as the same design move.
Visitor and Iterator often appear around object structures, but they solve different problems.
Iterator answers:
Visitor answers:
If traversal is the main problem, think Iterator.
If operation separation across a stable structure is the main problem, think Visitor.
The patterns can coexist, but they should not be confused.