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

Remove unnecessary null check in FoldedTreeSet

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.1.1
    • Component/s: None
    • Labels:
      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

            People

            • Assignee:
              Sushma_28 Ravuri Sushma sree
              Reporter:
              Sushma_28 Ravuri Sushma sree
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: