static int[] dailyTemperatures(int[] a) {
        if (a == null || a.length == 0) {
            return a;
        }
        TreeMap<Integer, TreeSet<Integer>> map = new TreeMap<>();
        for (int i = 0; i < a.length; i++) {
            if (!map.containsKey(a[i]))
                map.put(a[i], new TreeSet<>());
            map.get(a[i]).add(i);
        }
        int[] res = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            Integer k = 0;
            Map.Entry<Integer, TreeSet<Integer>> entry = null;
            int search = a[i];
            int min = Integer.MAX_VALUE;
            while ((entry = map.higherEntry(search)) != null) {
                k = entry.getValue().higher(i);
                if (k != null && k - i > 0) {
                    min = Math.min(min, k - i);
                }
                search = entry.getKey();
            }
            res[i] = min == Integer.MAX_VALUE ? 0 : min;
        }

        return res;
    }
Why Did you create this class? what does it do?
src/problems/medium/DailyTemperature.java