segmentBy(keySelector) {
        let seq = this;
        return Seq.fromGenerator(function*() {
            let group = [];
            let lastKey = undefined;
            for (let item of seq) {
                let itemKey = keySelector(item);
                if (group.length > 0 && itemKey !== lastKey) {
                    yield group;
                    group = [];
                }
                group.push(item);
                lastKey = itemKey;
            }
            if (group.length > 0) {
                yield group;
            }
        });
    }
@param {!function(T):*} keySelector
@returns {!Seq.<T>}
@template T