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