withOverlayedItem(index, overlayedItem) {
        if (index < 0) {
            throw new Error("needed index >= 0");
        }
        let self = this;
        return Seq.fromGenerator(function*() {
            if (self.tryPeekCount() !== undefined && index >= self.tryPeekCount()) {
                throw new Error("needed index <= count");
            }
            let i = 0;
            for (let e of self._iterable) {
                yield i === index ? overlayedItem : e;
                i++;
            }
            if (i <= index) {
                throw new Error("sequence ended before overlay " +
                    "[withOverlayedItem(${index}, ${overlayedItem})]");
            }
        });
    }
Returns a sequence with the same items, except the item at the given index is replaced.
If the index is not reached during iteration, an exception is thrown.
@param {!int} index
@param {A} overlayedItem
@returns {!Seq.<T|A>}
@template T, A