public function size() {
        /** @var Node $node */
        $node = $this->next;
        $size = 1;

        while ($node !== null) {
            $size++;
            $node = $node->getNext();
        }
        return $size;
    }