public function getLength()
    {
        if (!$this->container) {
            return 0;
        }

        $count = count($this->container);
        $keys = array_keys($this->container);
        return (array_keys($this->container) === range(0, $count - 1))
            ? $count
            : max($keys);
    }