size++;
size = size + 1;
    public Pair insert(Object insertData)    {        ASSERT(insertData);        // handle the case of empy tree        if (root == NULL)        {            root = new RBNode(insertData);            root.black = true;            // setup the sentinell NULL            root.left = NULL;            root.right = NULL;            size = size + 1;            return new Pair(root, Boolean.TRUE);        }        // not an empty tree        // find my insertion point        RBNode insertionPoint = root;        while (true)        {            Object parentData = insertionPoint.nodeData;            if (myComperator.isLess(insertData, parentData))            {                // insertData < parentData => go left                if (insertionPoint.left != NULL)                {                    // have a left sub-tree - continue to search                    insertionPoint = insertionPoint.left;                }                else                {                    // reached a leaf - insert the data and get out                    insertionPoint.left = new RBNode(insertData);                    insertionPoint.left.parent = insertionPoint;                    insertionPoint = insertionPoint.left;                    // setup the sentinell NULL                    insertionPoint.left = NULL;                    insertionPoint.right = NULL;                    size++;                    break;                }            }            else            {                // insertData >= parentData                if (myComperator.isLess(parentData, insertData))                {                    // insertData > parentData => go right                    if (insertionPoint.right != NULL)                    {                        // have a right sub-tree - continue to search                        insertionPoint = insertionPoint.right;                    }                    else                    {                        // reached a leaf - insert the data and get out                        insertionPoint.right = new RBNode(insertData);                        insertionPoint.right.parent = insertionPoint;                        insertionPoint = insertionPoint.right;                        // setup the sentinell NULL                        insertionPoint.left = NULL;                        insertionPoint.right = NULL;                        size++;                        break;                    }                }                else                {                    // insertData == parentData => replace the node                    // and quit                    insertionPoint.nodeData = insertData;                    return new Pair(insertionPoint, Boolean.FALSE);                }            }        }        // the node has been inserted. it is red (by design of RBNode).        // now I am going to rebalance the tree.        // this code is taken verbatim from CLR's         // Introduction to Algorithms. hope they don't mind :)        RBNode currNode = insertionPoint;        while (currNode != root && currNode.parent.isRed())        {            // currNode is not the root.            // the parent is RED. i know (by design) that the root            // is always BLACK, so the parent cannot be the root either.            RBNode parent = currNode.parent;            RBNode grandparent = parent.parent;            if (parent == grandparent.left)            {                RBNode uncle = grandparent.right;                if (uncle != NULL && uncle.isRed())                {                    parent.black = true;                    uncle.black = true;                    grandparent.black = false;                    currNode = grandparent;                }                else                {                    if (currNode == parent.right)                    {                        leftRotate(parent);                        // swap parent and currNode after the rotation                        RBNode temp = currNode;                        currNode = parent;                        parent = temp;                    }                    parent.black = true;                    grandparent.black = false;                    rightRotate(grandparent);                }            }            else            {                RBNode uncle = grandparent.left;                if (uncle != NULL && uncle.isRed())                {                    parent.black = true;                    uncle.black = true;                    grandparent.black = false;                    currNode = grandparent;                }                else                {                    if (currNode == parent.left)                    {                        rightRotate(parent);                        // swap parent and currNode after the rotation                        RBNode temp = currNode;                        currNode = parent;                        parent = temp;                    }                    parent.black = true;                    grandparent.black = false;                    leftRotate(grandparent);                }            }        }        root.black = true;        return new Pair(insertionPoint, Boolean.TRUE);    }