JAVA easy-to-understand
\nclass Solution \n{\n    public List<List<String>> displayTable(List<List<String>> orders) \n    {\n        TreeMap<String, Integer> food_map = new TreeMap<>()
```\nclass Solution \n{\n    public List<List<String>> displayTable(List<List<String>> orders) \n    {\n        TreeMap<String, Integer> food_map = new TreeMap<>();\n        \n        //Creating the FOOD_MAP\n        for(int i=0;i<orders.size();i++)\n        {\n            List<String> od = orders.get(i);\n            \n            String food = od.get(2);\n            food_map.put(food, 0);\n        }\n        \n        TreeMap<Integer, TreeMap<String, Integer>> map = new TreeMap<>();\n        \n        //Assigning a FOOD_MAP for all the tables.\n        for(int i=0;i<orders.size();i++)\n        {\n            List<String> od = orders.get(i);\n            \n            int no = Integer.parseInt(od.get(1));\n            map.put(no, new TreeMap(food_map));\n        }\n        \n        //Updation of FOOD_MAP for different tables.\n        for(int i=0;i<orders.size();i++)\n        {\n            List<String> od = orders.get(i);\n            \n            int no = Integer.parseInt(od.get(1));\n            String food = od.get(2);\n            \n            TreeMap<String, Integer> mp = map.get(no);\n                \n            mp.put(food, mp.get(food) + 1);\n            map.put(no, mp);\n            \n        }\n        \n        //OUTPUT\n        List<List<String>> output = new ArrayList<>();\n        \n        List<String> header = new ArrayList<>();\n        header.add("Table");\n        for(String key : food_map.keySet())\n        {\n            header.add(key);\n        }\n        \n        output.add(header);\n        \n        for(int key : map.keySet())\n        {\n            List<String> list = new ArrayList<>();\n            String n = String.valueOf(key);\n            list.add(n);\n            \n            TreeMap<String, Integer> mp = map.get(key);\n            \n            for(int val : mp.values())\n            {\n                String s = String.valueOf(val);\n                list.add(s);\n            }\n            \n            output.add(list);\n        }\n        \n        return output;\n    }\n}\n```
['Java']