src/Collection/Tree/RedBlackSearchTree.php
protected function nodeMax(RedBlackNode $node): RedBlackNode
    {
        if ($node->right() === null) {
            return $node;
        }

        return $this->nodeMax($node->right());
    }
protected function nodeMax(RedBlackNode $node): RedBlackNode
    {
        if ($node->right() === null) {
            return $node;
        }

        return $this->nodeMax($node->right());
    }
protected function nodeMax ( RedBlackNode $ node ) : RedBlackNode { if ( $ node -> right ( ) === null ) { return $ node ; } return $ this -> nodeMax ( $ node -> right ( ) ) ; }
Retrieves the node with the maximum key in a subtree

@param RedBlackNode $node The subtree root

@return RedBlackNode
Retrieves the node with the maximum key in a subtree