/** * Determine if a node has already been visited already by checking the cycleDetectionStack * for it's existence. This method is used -- rather than Stack.contains() -- because * we want to ignore the Node's 'next' attribute when comparing for equality. */ private boolean haveVisitedNodeAlready(Node node, Stack<Node> cycleDetectionStack) { for (Node cycleNode : cycleDetectionStack) { if (equalNodes(node, cycleNode)) { return true; } } return false; } private boolean equalNodes(Node node1, Node node2) {
/** * Determine if a node has already been visited already by checking the cycleDetectionStack * for it's existence. This method is used -- rather than Stack.contains() -- because * we want to ignore the Node's 'next' attribute when comparing for equality. */ private boolean haveVisitedNodeAlready(Node node, Stack<Node> cycleDetectionStack) { for (Node cycleNode : cycleDetectionStack) { if (equalNodes(node, cycleNode)) { return true; } } return false; }
/** * Determine if a node has already been visited already by checking the cycleDetectionStack * for it's existence. This method is used -- rather than Stack.contains() -- because * we want to ignore the Node's 'next' attribute when comparing for equality. */ private boolean haveVisitedNodeAlready(Node node, Stack<Node> cycleDetectionStack) { for (Node cycleNode : cycleDetectionStack) { if (equalNodes(node, cycleNode)) { return true; } } return false; }
/** * Determine if a node has already been visited already by checking the cycleDetectionStack * for it's existence. This method is used -- rather than Stack.contains() -- because * we want to ignore the Node's 'next' attribute when comparing for equality. */ private boolean haveVisitedNodeAlready(Node node, Stack<Node> cycleDetectionStack) { for (Node cycleNode : cycleDetectionStack) { if (equalNodes(node, cycleNode)) { return true; } } return false; } private boolean equalNodes(Node node1, Node node2) {
/** * Determine if a node has already been visited already by checking the cycleDetectionStack * for it's existence. This method is used -- rather than Stack.contains() -- because * we want to ignore the Node's 'next' attribute when comparing for equality. */ private boolean haveVisitedNodeAlready(Node node, Stack<Node> cycleDetectionStack) { for (Node cycleNode : cycleDetectionStack) { if (equalNodes(node, cycleNode)) { return true; } } return false; }
/** * Determine if a node has already been visited already by checking the cycleDetectionStack * for it's existence. This method is used -- rather than Stack.contains() -- because * we want to ignore the Node's 'next' attribute when comparing for equality. */ private boolean haveVisitedNodeAlready(Node node, Stack<Node> cycleDetectionStack) { for (Node cycleNode : cycleDetectionStack) { if (equalNodes(node, cycleNode)) { return true; } } return false; } private boolean equalNodes(Node node1, Node node2) {