Java Solution With Explanation
\nclass OrderedStream {\n    Map<Integer, String> stream;\n    int ptr; // intialize ptr, then find the longest contiguous increasing sequence of ids from the p
```\nclass OrderedStream {\n    Map<Integer, String> stream;\n    int ptr; // intialize ptr, then find the longest contiguous increasing sequence of ids from the ptr\n    public OrderedStream(int n) {\n        this.stream = new HashMap<>();\n        this.ptr = 1;\n    }\n    \n    public List<String> insert(int idKey, String value) {\n        stream.put(idKey, value);\n        \n        List<String> result = new ArrayList<>();\n        \n\t\t// if the id which the ptr is currently pointing to, is populated, find the longest contiguous sequence of data (chunks) available, else return empty list\n        while(stream.containsKey(ptr))\n        {\n\t\t//increment the ptr to next id until we reach an id that is not yet populated. Next time we\'ll start reading data from that id if it gets populated.\n            result.add(stream.get(ptr++));\n        }\n        \n        return result;\n    }\n}\n\n/**\n * Your OrderedStream object will be instantiated and called as such:\n * OrderedStream obj = new OrderedStream(n);\n * List<String> param_1 = obj.insert(idKey,value);\n */\n```
['Java']