java simple
\nclass OrderedStream {\n    private int ptr;\n    private String[] arr;\n    public OrderedStream(int n) {\n        arr = new String[n+1];\n        ptr = 1;\n 
```\nclass OrderedStream {\n    private int ptr;\n    private String[] arr;\n    public OrderedStream(int n) {\n        arr = new String[n+1];\n        ptr = 1;\n    }\n    \n    public List<String> insert(int idKey, String value) {\n        arr[idKey] = value;\n        List<String> str = new ArrayList<>();\n        while(ptr < arr.length && arr[ptr] != null )\n        {\n            str.add(arr[ptr]);\n            ptr++;\n        }\n        return str;\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 ```\n please upvote , if u find my code easy to understand
[]