public static <TNode extends AvlLinkedNode> TNode remove(TNode head, TNode node) {
      assert isLinked(node) : node + " is not linked";
      if (node != node.iterNext) {
        node.iterPrev.iterNext = node.iterNext;
        node.iterNext.iterPrev = node.iterPrev;
        head = (head == node) ? (TNode) node.iterNext : head;
      } else {
        head = null;
      }
      node.iterNext = null;
      node.iterPrev = null;
      return head;
    }
Remove a node from the tree
@param head the head of the linked list
@param node the node to remove from the list
@return the new head of the list
hbase-common/src/main/java/org/apache/hadoop/hbase/util/AvlUtil.java