Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-15123

Remove unnecessary null check in FoldedTreeSet

Add voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Minor
    • Resolution: Unresolved
    • None
    • 3.1.1
    • None
    • None

    Description

      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

      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;
       }
      

      Attachments

        1. HDFS-15123.001.patch
          1.0 kB
          Ravuri Sushma sree

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Sushma_28 Ravuri Sushma sree
            Sushma_28 Ravuri Sushma sree

            Dates

              Created:
              Updated:

              Slack

                Issue deployment