JAVA | Okay, sweetie, I know you think you’re explaining yourself, but you’re really not.
While I am reading the description, the voice of Penny from BIG BANG THEORY pop out.\n\n*Penny: Okay, sweetie, I know you think you\u2019re explaining yourself,
While I am reading the description, the voice of Penny from BIG BANG THEORY pop out.\n\n****Penny: Okay, sweetie, I know you think you\u2019re explaining yourself, but you\u2019re really not.****\n\n```\nclass OrderedStream {\n    String values[];\n    int top=0;\n    public OrderedStream(int n) {\n        this.values=new String[n+1];\n    }\n    \n    public List<String> insert(int idKey, String value) {\n        LinkedList<String> res=new LinkedList();\n        values[idKey]=value;        \n        for(int i=top+1;i<=idKey;i++){\n            if(values[i]==null){\n                break;\n            }\n            top=i;\n        }\n        if(top<idKey){\n            return res;\n        }\n        for(int i=idKey;i<values.length;i++){\n            if(values[i]!=null){\n                top=i;\n                res.add(values[i]);\n            }else{\n                return res;\n            }\n        }\n        return res;\n    }\n}\n```
['Java']