src/main/java/com/workplacesystems/utilsj/collections/TransactionalBidiTreeMap.java
private void insertValue(final Node<K,V> newNode, final String thread_id)
            throws IllegalArgumentException {

        Node<K,V> node = rootNode[VALUE];

        while (true) {
            int cmp = compare(Node.ADDED, newNode.getData(VALUE), node.getStatus(), node.getData(VALUE), VALUE);

            if (cmp == 0) 
            {
                if (nextEqualValid(getFloorEqualNode(node, VALUE), VALUE, thread_id) != null)
                {
                    String debug_message = "Cannot store a duplicate value (\"" + newNode.getData(VALUE) 
                                 + "\") in this Map. Value already exists for key " + node.getKey();
                    log.debug (debug_message);             
                    
                    throw new IllegalArgumentException(debug_message); 
                 }
                
                if (node.is(Node.ADDED, null))
                    throw new ConcurrentModificationException();

                if (node.getRight(VALUE) != null) {
                    node = node.getRight(VALUE);
                } else if (node.getLeft(VALUE) != null) {
                    node = node.getLeft(VALUE);
                } else {
                    node.setRight(newNode, VALUE);
                    newNode.setParent(node, VALUE);
                    doRedBlackInsert(newNode, VALUE);

                    break;
                }
            } 
            else if (cmp < 0) {
                if (node.getLeft(VALUE) != null) {
                    node = node.getLeft(VALUE);
                } else {
                    node.setLeft(newNode, VALUE);
                    newNode.setParent(node, VALUE);
                    doRedBlackInsert(newNode, VALUE);

                    break;
                }
            } else {    // cmp > 0
                if (node.getRight(VALUE) != null) {
                    node = node.getRight(VALUE);
                } else {
                    node.setRight(newNode, VALUE);
                    newNode.setParent(node, VALUE);
                    doRedBlackInsert(newNode, VALUE);

                    break;
                }
            }
        }
    }
private void insertValue(final Node<K,V> newNode, final String thread_id)
            throws IllegalArgumentException {

        Node<K,V> node = rootNode[VALUE];

        while (true) {
            int cmp = compare(Node.ADDED, newNode.getData(VALUE), node.getStatus(), node.getData(VALUE), VALUE);

            if (cmp == 0) 
            {
                if (nextEqualValid(getFloorEqualNode(node, VALUE), VALUE, thread_id) != null)
                {
                    String debug_message = "Cannot store a duplicate value (\"" + newNode.getData(VALUE) 
                                 + "\") in this Map. Value already exists for key " + node.getKey();
                    log.debug (debug_message);             
                    
                    throw new IllegalArgumentException(debug_message); 
                 }
                
                if (node.is(Node.ADDED, null))
                    throw new ConcurrentModificationException();

                if (node.getRight(VALUE) != null) {
                    node = node.getRight(VALUE);
                } else if (node.getLeft(VALUE) != null) {
                    node = node.getLeft(VALUE);
                } else {
                    node.setRight(newNode, VALUE);
                    newNode.setParent(node, VALUE);
                    doRedBlackInsert(newNode, VALUE);

                    break;
                }
            } 
            else if (cmp < 0) {
                if (node.getLeft(VALUE) != null) {
                    node = node.getLeft(VALUE);
                } else {
                    node.setLeft(newNode, VALUE);
                    newNode.setParent(node, VALUE);
                    doRedBlackInsert(newNode, VALUE);

                    break;
                }
            } else {    // cmp > 0
                if (node.getRight(VALUE) != null) {
                    node = node.getRight(VALUE);
                } else {
                    node.setRight(newNode, VALUE);
                    newNode.setParent(node, VALUE);
                    doRedBlackInsert(newNode, VALUE);

                    break;
                }
            }
        }
    }
insert a node by its value

@param newNode the node to be inserted

@throws IllegalArgumentException if the node already exists
in the value mapping