[ 
https://issues.apache.org/jira/browse/HDFS-15123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ravuri Sushma sree updated HDFS-15123:
--------------------------------------
    Attachment: HDFS-15123.001.patch

> 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
>            Priority: Minor
>             Fix For: 3.1.1
>
>         Attachments: HDFS-15123.001.patch
>
>
> *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
> {code:java}
> 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;
>  }
> {code}



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

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

Reply via email to