Walkers provide a mechanism for walking through an underlying listish thing, exposed as a "foreach" method. They
do not return iterators, nor do they allow random access. This allows them to guarantee post-iteration cleanup
actions on the underlying resource, which will occur even if exceptions are thrown while walking.
Walkers can be constructed such that the "foreach" method can only be called once. In that case, subsequent calls
should throw an IllegalStateException. Walkers can also be constructed with "foreach" methods that can be called
multiple times. In that case, each run should create and then clean up the resource-- saving state across runs is
usually counterproductive.
Walkers provide a mechanism for walking through an underlying listish thing, exposed as a "foreach" method. They do not return iterators, nor do they allow random access. This allows them to guarantee post-iteration cleanup actions on the underlying resource, which will occur even if exceptions are thrown while walking.
Walkers can be constructed such that the "foreach" method can only be called once. In that case, subsequent calls should throw an IllegalStateException. Walkers can also be constructed with "foreach" methods that can be called multiple times. In that case, each run should create and then clean up the resource-- saving state across runs is usually counterproductive.