public function offsetSet($offset, $value) { if (!\is_bool($value)) { throw new \InvalidArgumentException('$value is not a bool'); } //Expand the set if necessary if ($offset >= $this->count()) { $this->_List = $this->_List->concat(ArrayList::repeat(false, $offset - $this->count() + 1)); } $this->_List->offsetSet($offset, (bool) $value); }