📌[JAVA] | TreeMap | Simple
\nclass Solution {\n    public int[] sortJumbled(int[] mapping, int[] nums) {\n\n        if (nums.length == 0)\n            return nums;\n\n        TreeMap < In
```\nclass Solution {\n    public int[] sortJumbled(int[] mapping, int[] nums) {\n\n        if (nums.length == 0)\n            return nums;\n\n        TreeMap < Integer, List < Integer >> map = new TreeMap < > ();\n        int[] result = new int[nums.length];\n\n        for (int i = 0; i < nums.length; i++) {\n\n            String s = String.valueOf(nums[i]);\n            StringBuilder sb = new StringBuilder();\n            for (int j = 0; j < s.length(); j++) {\n                sb.append(mapping[Character.getNumericValue(s.charAt(j))]);\n            }\n            int val = Integer.valueOf(sb.toString());\n            if (map.containsKey(val))\n                map.get(val).add(i);\n            else\n                map.put(val, new ArrayList < > (Arrays.asList(i)));\n\n        }\n        int index = 0;\n        for (List < Integer > list: map.values()) {\n\n            for (int k: list) {\n                result[index++] = nums[k];\n            }\n        }\n        return result;\n\n    }\n}\n\n```
['Tree', 'Java']