Javascript : Simple And Concise Solution
\nvar OrderedStream = function(n) {\n    this.pointer = 0;\n    this.streamArray = new Array(n).fill(undefined);\n};\nOrderedStream.prototype.insert = function(
```\nvar OrderedStream = function(n) {\n    this.pointer = 0;\n    this.streamArray = new Array(n).fill(undefined);\n};\nOrderedStream.prototype.insert = function(idKey, value) {\n    this.streamArray[idKey-1] = value;\n    if(this.streamArray[this.pointer] === undefined){\n        return [];\n    }else{\n        const result = [];\n        while(this.streamArray[this.pointer] !== undefined){\n            result.push(this.streamArray[this.pointer]);\n            this.pointer++;\n        }\n        return result;\n    }\n};\n```
['JavaScript']