Java Simple HashMap
\nclass OrderedStream {\n    int index = 1;\n    Map<Integer, String> map = new HashMap<>();\n    \n    public OrderedStream(int n) {\n    }\n    \n    public L
```\nclass OrderedStream {\n    int index = 1;\n    Map<Integer, String> map = new HashMap<>();\n    \n    public OrderedStream(int n) {\n    }\n    \n    public List<String> insert(int id, String value) {\n        map.put(id, value);\n        List<String> result = new ArrayList<>();\n        while (map.containsKey(index))\n            result.add(map.get(index++));\n        return result;\n    }\n}\n```
[]