class BinaryTreeInOrder {

  public List<BinaryNode<Integer>> getIterative(BinaryNode<Integer> root) {
    validateBinaryNode(root);

    List<BinaryNode<Integer>> result = new LinkedList<BinaryNode<Integer>>();
    Stack<BinaryNode> stack = new Stack<BinaryNode>();
    //Define a pointer to track nodes
    BinaryNode current = root;
    while (!stack.empty() || current != null) {
      if (current != null) {
        //If it is not null, push to stack and go down the tree to left
        stack.push(current);
        current = current.getLeft();
      } else {
        //If no left child pop stack, process the node then let current point to the right
        BinaryNode node = stack.pop();
        result.add(node);
        current = node.getRight();
      }
    }
    return result;
  }

}