[Java] Concise
\n    public List<List<String>> displayTable(List<List<String>> orders) {\n        final Map<Integer, Map<String, Integer>> map = new HashMap<>();\n        fina
```\n    public List<List<String>> displayTable(List<List<String>> orders) {\n        final Map<Integer, Map<String, Integer>> map = new HashMap<>();\n        final Set<String> dishes = new HashSet<>();\n        for (List<String> o : orders) {\n            map.computeIfAbsent(Integer.parseInt(o.get(1)), v -> new HashMap<>())\n               .merge(o.get(2), 1, Integer::sum);\n            dishes.add(o.get(2));\n        }\n        final List<String> sortedDish = new ArrayList<>(dishes);\n        final List<Integer> tables = new ArrayList<>(map.keySet());\n        Collections.sort(sortedDish);\n        Collections.sort(tables);\n        final List<List<String>> res = new ArrayList<>();\n        for (Integer table : tables) {\n            final List<String> append = new ArrayList<>(Collections.singleton(String.valueOf(table)));\n            final Map<String, Integer> currTable = map.get(table);\n            for (String s : sortedDish) {\n                append.add(String.valueOf(currTable.getOrDefault(s, 0)));\n            }\n            res.add(append);\n        }\n        sortedDish.add(0, "Table");\n        res.add(0, sortedDish);\n        return res;\n    }\n```
[]