public void addNum(int val) {
            Node node = new Node(val);
            if(!treeSet.add(node)) return;
            Node prev = treeSet.lower(node);
            Node next = treeSet.higher(node);
            if (prev != null) {
                node.prev = prev;
                prev.next=node;
                if (prev.value == val - 1) {
                    node.seqPrev = prev.seqPrev;
                    prev.seqPrev.seqNext=node;
                    if( next!=null && next.value==val+1){
                        prev.seqPrev.seqNext=next.seqNext;
                    }
                }
            }

            if (next != null) {
                node.next = next;
                next.prev=node;
                if (next.value == val + 1) {
                    node.seqNext = next.seqNext;
                    next.seqNext.seqPrev=node;
                    if(prev!=null && prev.value==val-1){
                        next.seqNext.seqPrev=prev.seqPrev;
                    }
                }
            }
        }