public function put($key, $value): CollectionInterface
    {
        return $this->wrap(function (Iterator $data) use ($key, $value) {
            $replaced = false;

            foreach ($data as $dataKey => $datum) {
                if ($key === $dataKey) {
                    yield $key => $value;
                    $replaced = true;
                } else {
                    yield $dataKey => $datum;
                }
            }

            if (!$replaced) {
                yield $key => $value;
            }
        });
    }