public int[] advantageCount(int[] a, int[] b) {
        if (a == null || a.length != b.length)
            return a;
        TreeMap<Integer, Integer> map = new TreeMap<>();
        int[] r = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            map.put(a[i], map.getOrDefault(a[i], 0) + 1);
        }
        for (int i = 0; i < b.length; i++) {
            Integer val = map.higherKey(b[i]);
            if (val == null) {
                val = map.firstKey();
            }
            map.put(val, map.get(val) - 1);
            r[i] = val;
            if (map.get(val) == 0) {
                map.remove(val);
            }
        }
        return r;
    }
Why Did you create this class? what does it do?
src/problems/medium/AdvantageShuffle.java