public void insert(Comparable item){
  current=parent=grand=header;
  nullNode.element=item;
  while (compare(item,current) != 0) {
    great=grand;
    grand=parent;
    parent=current;
    current=compare(item,current) < 0 ? current.left : current.right;
    if (current.left.color == RED && current.right.color == RED)     handleReorient(item);
  }
  if (current != nullNode)   throw new DuplicateItemException(item.toString());
  current=new RedBlackNode(item,nullNode,nullNode);
  if (compare(item,parent) < 0)   parent.left=current;
 else   parent.right=current;
  handleReorient(item);
}

public void insert ( Comparable item ) { current = parent = grand = header ; nullNode . element = item ; while ( compare ( item , current ) != 0 ) { great = grand ; grand = parent ; parent = current ; current = compare ( item , current ) < 0 ? current . left : current . right ; if ( current . left . color == RED && current . right . color == RED ) handleReorient ( item ) ; } if ( current != nullNode ) throw new DuplicateItemException ( item . toString ( ) ) ; current = new RedBlackNode ( item , nullNode , nullNode ) ; if ( compare ( item , parent ) < 0 ) parent . left = current ; else parent . right = current ; handleReorient ( item ) ; }
insert into the tree .
