private function removeLastAndPlaceAtTheTop() { for ($next = $this->right(); $next->left()->isEmpty();) { $next = $next->left(); } return new self($next->key(), $next->value(), $this->left, $this->right->remove($next->key())); }