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;
  }
Iterative implementation of this binary tree traversal. The complexity order in time terms of
this algorithm is O(N) where N is the number of nodes in the tree. In space terms the
complexity order of this algorithm is also O(N) where N is the number of nodes we have to
store in the auxiliary data structure, the stack.
src/main/java/com/github/pedrovgs/problem15/BinaryTreeInOrder.java