private void updateHeight(AVLTreeNode<E> node) { if (node.left == null && node.right == null) node.height = 0; else if (node.left == null) node.height = 1 + ((AVLTreeNode<E>) (node.right)).height; else if (node.right == null) node.height = 1 + ((AVLTreeNode<E>) (node.left)).height; else node.height = 1 + Math.max( ((AVLTreeNode<E>) (node.right)).height, ((AVLTreeNode<E>) (node.left)).height); }