Easy Typescript solution
\nclass OrderedStream {\n    stream: string[]\n    index: number;\n    constructor(n: number) {\n        this.stream = []\n        this.index = 0;\n    }\n\n   
```\nclass OrderedStream {\n    stream: string[]\n    index: number;\n    constructor(n: number) {\n        this.stream = []\n        this.index = 0;\n    }\n\n    insert(idKey: number, value: string): string[] {\n        this.stream[idKey-1] = value;\n        \n        if(this.index === idKey-1) {\n            while(this.stream[this.index]) {\n                this.index++;\n            }\n        }\n        return this.stream.slice(idKey-1,this.index);\n    }\n}\n```
['TypeScript']