Node node = first;
while (node != end) {
// Get the next node before calling the iteratee just in case
// it does anything to the current node, i.e. removes it.
Node next = node.getNext();
IterationAction action = nodeIteratee.next(node);
if (action == IterationAction.BREAK) {
break;
} else if (action != IterationAction.CONTINUE) {
throw new IllegalStateException(
"Unknown iteration action: " + action);