@@ -0,0 +1,1196 @@
+package leetcode.binary_search_tree_iterator;%0A%0Aimport common.TreeNode;%0A%0Apublic class BSTIterator %7B%0A    Integer biggest = null;%0A    Integer curVal = null;%0A    TreeNode root;%0A%09%0A    public BSTIterator(TreeNode root) %7B%0A        this.root = root;%0A        TreeNode cur = root;%0A        if(cur != null)%7B%0A            while(cur.right != null)%7B%0A                cur = cur.right;%0A            %7D%0A            biggest = cur.val;%0A        %7D%0A    %7D%0A%0A    /** @return whether we have a next smallest number */%0A    public boolean hasNext() %7B%0A        if(biggest == null) return false;%0A        return curVal == null %7C%7C biggest %3E curVal;%0A    %7D%0A%0A    /** @return the next smallest number */%0A    public int next() %7B%0A        TreeNode cur = root;%0A        int smallest = biggest;%0A        if(curVal == null %7C%7C cur.val %3E curVal)%0A            smallest = cur.val;%0A        while(cur != null)%7B%0A            if(curVal == null %7C%7C cur.val %3E curVal)%7B%0A                cur = cur.left;%0A            %7Delse%7B%0A                cur = cur.right;%0A            %7D%0A            if(cur != null && cur.val %3C smallest && (curVal == null %7C%7C cur.val %3E curVal))%7B%0A                smallest = cur.val;%0A            %7D%0A        %7D%0A        return curVal = smallest;%0A    %7D%0A%7D%0A

Add java solution for 173. Binary Search Tree Iterator