Ravuri Sushma sree created HDFS-15123:
-----------------------------------------

             Summary: Remove unnecessary null check in FoldedTreeSet
                 Key: HDFS-15123
                 URL: https://issues.apache.org/jira/browse/HDFS-15123
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: Ravuri Sushma sree
            Assignee: Ravuri Sushma sree
             Fix For: 3.1.1


private void deleteNode(final Node<E> node) {
 +*if (node.right == null) {*+
 if (node.left != null) {
 attachToParent(node, node.left);
 } else {
 attachNullToParent(node);
 }
 +*} else if (node.left == null) {*+
 attachToParent(node, node.right);
 } *else {*
else {
 // node.left != null && node.right != null
 // node.next should replace node in tree
 // node.next != null guaranteed since node.left != null
 // node.next.left == null since node.next.prev is node
 // node.next.right may be null or non-null
 Node<E> toMoveUp = node.next;
 if (toMoveUp.right == null) {
 attachNullToParent(toMoveUp);
 } else {
 attachToParent(toMoveUp, toMoveUp.right);
 }
 toMoveUp.left = node.left;
 *if (toMoveUp.left != null) {*
 toMoveUp.left.parent = toMoveUp;
}
 toMoveUp.right = node.right;
*if (toMoveUp.right != null) {*
 toMoveUp.right.parent = toMoveUp;
 }
 attachToParentNoBalance(node, toMoveUp);
 toMoveUp.color = node.color;
 }

*if (toMoveUp.left != null)* and  *if (toMoveUp.right != null)* null checks are 
not necessary as they are being handled in the if and else if conditions



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org

Reply via email to